devise get current use in another controler

22 views
Skip to first unread message

Julien Estebane

unread,
Jan 4, 2013, 3:58:33 PM1/4/13
to rubyonra...@googlegroups.com
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

Dheeraj Kumar

unread,
Jan 4, 2013, 4:05:13 PM1/4/13
to rubyonra...@googlegroups.com
current_user holds the current logged in user.

-- 
Dheeraj Kumar

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/P6zFavJ5QfQJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Julien Estebane

unread,
Jan 4, 2013, 5:04:54 PM1/4/13
to rubyonra...@googlegroups.com
Thanks Dheeraj. That works!
Reply all
Reply to author
Forward
0 new messages