diff --git a/CHANGELOG.md b/CHANGELOG.md index 40eca831b..744084c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 2.7.2 (Unreleased) + - [#228](https://github.com/airblade/paper_trail/issues/228) - Refactored default `user_for_paper_trail` method implementation + so that `current_user` only gets invoked if it is defined. - [#219](https://github.com/airblade/paper_trail/pull/219) - Fixed issue where attributes stored with `nil` value might not get reified properly depending on the way the serializer worked. - [#187](https://github.com/airblade/paper_trail/pull/187) - Confirmed JRuby support. diff --git a/lib/paper_trail/controller.rb b/lib/paper_trail/controller.rb index 974d1c7c9..6bbbe70aa 100644 --- a/lib/paper_trail/controller.rb +++ b/lib/paper_trail/controller.rb @@ -14,7 +14,7 @@ def self.included(base) # 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 + current_user if defined?(current_user) end # Returns any information about the controller or request that you