On Apr 29, 2010, at 11:03 AM, Bryan Larsen wrote:
current_user is only available in your controllers/views. If it
was available in models, that would break the model/view paradigm.
There are two places where the user is available in models in Hobo:
- permissions
- lifecycles
- creator attributes (http://cookbook.hobocentral.net/manual/model#creator
)
In both of those cases, the user is either a parameter or a "pseudo-
parameter" so that the model/view paradigm is not broken. That
explains why "acting_user" is only available from within permission
functions, and not for all methods in your model. It's also why you
have to use `record.creatable_by?(user)` and friends when using
permission functions directly.
acting_user is also (typically) set during the AR callbacks; this is a
side-effect of the way that user_save and friends are set up. You have
to be more careful, as objects saved by other means (calling .save
directly, for instance) won't have a user, but it can help in obscure
situations.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en.