Question

I have a problem to set the home page of my application.

My rails2 route:

map.login   'login',  :controller => 'user_sessions', :action => 'new'
map.root :login

My rails3 route:

match 'login', :to => 'user_sessions#new', :as => 'login'
root :to => :login

But "root :to => :login" give me this error:

No route matches "/" 

And with:

root :to => 'users_sessions#new'

I have this error:

uninitialized constant UsersSessionsController

I can not figure out where this error. Does anyone have any idea?

Thx, have a good day

Michaël

Was it helpful?

Solution

I think root :to => needs to point to a string in the format of controller#action like your second example, not a symbol.

Also, you typed "users_sessions" instead of "user_sessions". This should work:

root :to => 'user_sessions#new'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top