your pointing your route to ‘session’ not ‘sessions’.  It should be get 
‘/login’ => ‘sessions#new, as: :login

Matt

> On Apr 3, 2016, at 5:14 PM, Rajinder Yadav <[email protected]> wrote:
> 
> I don't understand why I am getting the error "uninitialized constant
> SessionController" when I use the path login_path vs new_session_path
> which works fine?
> 
> My routes is defined like this:
> 
>  resource :session
>  get '/login' => 'session#new', as: 'login'
>  get '/logout' => 'session#destroy', as: 'logout'
> 
> 
>     session POST   /session(.:format)           sessions#create
> new_session GET    /session/new(.:format)       sessions#new
> edit_session GET    /session/edit(.:format)      sessions#edit
>             GET    /session(.:format)           sessions#show
>             PATCH  /session(.:format)           sessions#update
>             PUT    /session(.:format)           sessions#update
>             DELETE /session(.:format)           sessions#destroy
>       login GET    /login(.:format)             session#new
>      logout GET    /logout(.:format)            session#destroy
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/CAMRGebi9bLOwJ9YoG1WBrn13eKAjGhp8vK-fj99nxKJesbxVXA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/A59ACC12-242C-4B9C-B47B-172E9F1187F7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to