I upgraded an app I am working on from Rails 3.0.0.beta4 to Rails 3.0.0 and hit an unexpected error. I'm using authlogic for authentication, and after the upgrade the route for new user session form started throwing this error.
undefined method `user_sessions_path'
Ok, I'm using a singular controller name. Not sure what is different between beta4 and the new release that caused the problem.
In my routes.rb file I have this:
get "user_session/new", :as => :login
get "user_session/destroy", :as => :logout
resources :user_session, :controller => :user_session
Which defines my singular controller routes.
To fix the problem I had to change the first line of the form from this:
<%= form_for @user_session do |f| %>
to this:
<%= form_for @user_session, :url => user_session_index_path do |f| %>
What is striking me as weird is the name of the route. Running rake routes revealed the name of the route, but I don't understand why the index was needed. I was expecting something more like user_session_path for the post method. My user_session routes are the only ones acting this way. All of the other are as I expect.
Heres the output from rake routes:
user_session_index GET /user_session(.:format) {:action=>"index", :controller=>"user_session"}
user_session_index POST /user_session(.:format) {:action=>"create", :controller=>"user_session"}
This works, but I'm curious to know if anyone else has encountered this.