Rails 3 - Oberserver - Failed User Devise @current_user

We create the Rails 3 application and observe ...

in the observer, I need the user current_user var, which DEVISE allows me to view my views ...

How can you use current_user.name or current_user.id in Observer?

thanks

+4
source share
1 answer

Create a User.current accessor that sets / reads Thread.current [: user] :

http://rails-bestpractices.com/posts/47-fetch-current-user-in-models

+6
source

All Articles