Is it safe to put reference to current user in User model in Rails?

Posted by Art Shayderov on Stack Overflow See other posts from Stack Overflow or by Art Shayderov
Published on 2010-03-26T08:34:32Z Indexed on 2010/03/26 8:43 UTC
Read the original article Hit count: 256

Filed under:
|
|

You know, I think I have to check current user in the model callbacks (like before_update). Rather than rely solely on adding where ('something.user_id = ?', 'current_user.id') in the controllers. I need something like Thread.CurrentPrincipal in .NET
Is it safe to put reference to current user in User model? I'm sorry I don't really understand how it works under the hood yet.
Or how you do it The Rails way?
Sorry if this a silly question.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rails