From 364e64a181621c643b3eae7fce834d10cb8d0592 Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Thu, 7 Dec 2017 14:08:12 -0500 Subject: [PATCH] Remove defunct controller ivar --- CHANGELOG.md | 3 ++- lib/paper_trail/frameworks/rails/controller.rb | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8308f88d..eeb5979c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/). belongs_to_required_by_default will produce an error instead of a warning. - Failing to set PaperTrail.config.track_associations will no longer produce a warning. The default (false) will remain the same. -- warn_about_not_setting_whodunnit controller method +- The `warn_about_not_setting_whodunnit` controller method will be removed. + Remove callbacks like `skip_after_action :warn_about_not_setting_whodunnit`. - [#997](https://github.com/airblade/paper_trail/pull/997) - where_object_changes reading YAML from a text column diff --git a/lib/paper_trail/frameworks/rails/controller.rb b/lib/paper_trail/frameworks/rails/controller.rb index 08fe9358..c28523af 100644 --- a/lib/paper_trail/frameworks/rails/controller.rb +++ b/lib/paper_trail/frameworks/rails/controller.rb @@ -66,14 +66,17 @@ module PaperTrail # Tells PaperTrail who is responsible for any changes that occur. def set_paper_trail_whodunnit - @set_paper_trail_whodunnit_called = true - ::PaperTrail.whodunnit = user_for_paper_trail if ::PaperTrail.enabled_for_controller? + if ::PaperTrail.enabled_for_controller? + ::PaperTrail.whodunnit = user_for_paper_trail + end 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 if ::PaperTrail.enabled_for_controller? + if ::PaperTrail.enabled_for_controller? + ::PaperTrail.controller_info = info_for_paper_trail + end end # We have removed this warning. We no longer add it as a callback.