lib/paper_trail/controller.rb in paper_trail-2.1.1 vs lib/paper_trail/controller.rb in paper_trail-2.2.0

- old
+ new

@@ -2,10 +2,11 @@ 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 end protected # Returns the user who is responsible for any changes that occur. @@ -37,9 +38,16 @@ def info_for_paper_trail {} end private + + # Tells PaperTrail if version should be saved. + def set_paper_trail_enabled_for_controller + if respond_to? :paper_trail_enabled_for_controller + ::PaperTrail.enabled_for_controller = paper_trail_enabled_for_controller + end + end # Tells PaperTrail who is responsible for any changes that occur. def set_paper_trail_whodunnit ::PaperTrail.whodunnit = user_for_paper_trail end