Module: Mcfly::Controller
- Defined in:
- lib/mcfly/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#set_mcfly_whodunnit ⇒ Object
Tells Mcfly who is responsible for any changes that occur.
-
#user_for_mcfly ⇒ Object
Returns the user who is responsible for any changes that occur.
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/mcfly/controller.rb', line 3 def self.included(base) base.before_action :set_mcfly_whodunnit end |
Instance Method Details
#set_mcfly_whodunnit ⇒ Object
Tells Mcfly who is responsible for any changes that occur.
17 18 19 |
# File 'lib/mcfly/controller.rb', line 17 def set_mcfly_whodunnit ::Mcfly.whodunnit = user_for_mcfly end |
#user_for_mcfly ⇒ Object
Returns the user who is responsible for any changes that occur. By default this calls ‘current_user` and returns the result.
Override this method in your controller to call a different method, e.g. ‘current_person`, or anything you like.
12 13 14 |
# File 'lib/mcfly/controller.rb', line 12 def user_for_mcfly current_user rescue nil end |