I’ve used the following code in rails 2.3 without having to have a named route:
<% form_tag :controller => :session, :action => :login do %>
<ul>
<li><%= label_tag :email %><%= text_field_tag :email %></li>
<li><%= label_tag :password %><%= password_field_tag :password %></li>
<li><%= submit_tag 'Sign In', :id => 'login_submit' %></li>
</ul>
<% end %>
However, I’m converting my app to a 3.0 app and I get an error message saying “No route matches “/session/login”.”
Do I need to create a named route in rails 3.0 or is there a better way to do this?
Creating a named route doesn’t seem like the right approach because people would be able to call that through the url.
You can add resources route for sessions:
and fix form:
Remember rename you login action in sessions controller to new
UPD:
or you can add named route for ‘session/login’
and use: