From ab04c3c69b067fae61bd469aea814cac1538adb0 Mon Sep 17 00:00:00 2001 From: Shweelan Sam Date: Wed, 19 Mar 2014 11:04:34 +0300 Subject: [PATCH] Fallback in user_for_paper_trail to accept current_user returning a string --- lib/paper_trail/frameworks/rails.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/paper_trail/frameworks/rails.rb b/lib/paper_trail/frameworks/rails.rb index 951a74d83..66209cbe7 100644 --- a/lib/paper_trail/frameworks/rails.rb +++ b/lib/paper_trail/frameworks/rails.rb @@ -17,7 +17,13 @@ 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.try(:id) if defined?(current_user) + if defined?(current_user) + begin + current_user.try(:id) + rescue NoMethodError + current_user + end + end end # Returns any information about the controller or request that you