Refactoring default :user_for_paper_trail method so that 'current_user' only gets invoked if it is defined. Close #228

This commit is contained in:
Ben Atkins 2013-05-22 10:58:42 -04:00
parent e6ba772c95
commit 9da4930ab5
2 changed files with 3 additions and 1 deletions

View File

@ -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.

View File

@ -14,7 +14,7 @@ module PaperTrail
# 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