On 16 Sep 2010, at 09:31, Mike Disuza wrote:
I am using Restful authentication for user authentication.
I want the current logged in user object in my model property.rb
Problem is current_user is not working on model.
How can I fix this I need that?
You have two options:
1. Pass the current user from your controller into your model method:
some_model.some_method(current_user)
2. Use threads to set a class variable on the User model. You can
either use the userstamp gem/plugin to provide you the functionality
(User.stamper) or extract the necessary code and roll your own: http://github.com/grosser/userstamp
The first method respects the separation of MVC better, the second can
be more convenient in some cases. It's up to you to decide the best
route.
Best regards
Peter De Berdt
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.