Forum: Ruby on Rails devise get current use in another controler

Posted by Julien Estebane (Guest)
on 2013-01-04 22:00
(Received via mailing list)
Dear Rails folks,

I have a user that has_many items, and an item model that belongs_to 
user.

In the controller for item, how do i access the current user that is 
logged
in? it's very easy to access the current logged in user from when in the
user controller/model/view with the @user variable, but i'm not sure how 
to
access the currently logged in user @user in the item controller MVC.


Authentication was implemented using composer, the devise gem is being 
used.

Thanks
Posted by Dheeraj Kumar (Guest)
on 2013-01-04 22:06
(Received via mailing list)
current_user holds the current logged in user.

--
Dheeraj Kumar
Posted by Julien Estebane (Guest)
on 2013-01-04 23:06
(Received via mailing list)
Thanks Dheeraj. That works!
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.