lib/paper_trail/controller.rb in paper_trail-2.6.3 vs lib/paper_trail/controller.rb in paper_trail-2.6.4

- old
+ new

@@ -1,19 +1,18 @@ module PaperTrail module Controller def self.included(base) - base.before_filter :set_paper_trail_whodunnit - base.before_filter :set_paper_trail_controller_info base.before_filter :set_paper_trail_enabled_for_controller + base.before_filter :set_paper_trail_whodunnit, :set_paper_trail_controller_info end protected # 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. def user_for_paper_trail current_user rescue nil end @@ -55,11 +54,11 @@ ::PaperTrail.enabled_for_controller = paper_trail_enabled_for_controller end # Tells PaperTrail who is responsible for any changes that occur. def set_paper_trail_whodunnit - ::PaperTrail.whodunnit = user_for_paper_trail + ::PaperTrail.whodunnit = user_for_paper_trail if paper_trail_enabled_for_controller end # DEPRECATED: please use `set_paper_trail_whodunnit` instead. def set_whodunnit logger.warn '[PaperTrail]: the `set_whodunnit` controller method has been deprecated. Please rename to `set_paper_trail_whodunnit`.' @@ -67,10 +66,10 @@ end # Tells PaperTrail any information from the controller you want # to store alongside any changes that occur. def set_paper_trail_controller_info - ::PaperTrail.controller_info = info_for_paper_trail + ::PaperTrail.controller_info = info_for_paper_trail if paper_trail_enabled_for_controller end end end