uninitialized constant SessionController

10 views
Skip to first unread message

Rajinder Yadav

unread,
Apr 3, 2016, 5:15:19 PM4/3/16
to rubyonra...@googlegroups.com
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

BuyzLots

unread,
Apr 3, 2016, 5:17:57 PM4/3/16
to rubyonra...@googlegroups.com
your pointing your route to ‘session’ not ‘sessions’. It should be get ‘/login’ => ‘sessions#new, as: :login

Matt
> --
> 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 rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> 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.

Rajinder Yadav

unread,
Apr 3, 2016, 5:25:52 PM4/3/16
to rubyonra...@googlegroups.com
I missed that, it's always something easy .... Thanks!
> 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.



--
Kind Regards,
Rajinder Yadav

SafetyNet Test Driven Development
http://safetynet.devmentor.org
Reply all
Reply to author
Forward
0 new messages