Question

Im building a Rails 3 app, and have an Observer...

in the observer I need to user the current_user var that DEVISE allows me to user across my views...

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

Thank you

Was it helpful?

Solution

Create User.current accessor, which sets/reads Thread.current[:user]:

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top