Rails provides a great feature that is model callback开发者_运维知识库. These callbacks matches steps of an Active record object life cycle : after_save, before_validation, etc...
Therefore I'm wondering if we could has specific callbacks. For instance, :after_login
, :before_login
, :after_logout
, ... for an user model would be great. How would one do that ?
There's the obvious way : inside your controller. Is there another one ?
It's really very specific to your system, like how your user is logged or not.
You need to do yourself this callback. You can use the ActiveSupport::Callback to do that. You can made some feature request on your Authentication plugin.
精彩评论