ruby on rails - How to use session_path with simple_form? -
i'd adapt form_tag simple_form
<%= form_tag sessions_path %> <%= label_tag :password %> <%= password_field_tag :password %> <% end %>
it works fine, can log in normally.
<%= simple_form_for(sessions_path) |f| %> <%= f.error_notification %> <%= f.input :password %> <%= f.button :submit %> <% end %>
here no route matches [post] "/sessions/new"
in routes.rb have following line
get 'login', :controller => 'sessions', :action => 'new'
could me fix it?
form_for
(and therefore simple_form_for
) assume have model , posting or patching resource route.
but don't have model , route route, need pass in options simple_form make work.
this should it:
simple_form_for(sessions_path), method: :get
but there's answer should (not accepted one, second one):
Comments
Post a Comment