From 6fbbcb1f763179bba3148fe47fca542ba5a23968 Mon Sep 17 00:00:00 2001 From: Ivan Denysov Date: Thu, 7 Apr 2016 13:52:07 +0300 Subject: [PATCH] Take private/protected methods into consideration Don't forger about private/public methods hen checking if value of `:meta` hash is a method http://ruby-doc.org/core-2.3.0/Object.html#method-i-respond_to-3F --- lib/paper_trail/has_paper_trail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/paper_trail/has_paper_trail.rb b/lib/paper_trail/has_paper_trail.rb index a1eb2f42..3ce9c455 100644 --- a/lib/paper_trail/has_paper_trail.rb +++ b/lib/paper_trail/has_paper_trail.rb @@ -469,7 +469,7 @@ module PaperTrail data[k] = if v.respond_to?(:call) v.call(self) - elsif v.is_a?(Symbol) && respond_to?(v) + elsif v.is_a?(Symbol) && respond_to?(v, true) # If it is an attribute that is changing in an existing object, # be sure to grab the current version. if has_attribute?(v) && send("#{v}_changed?".to_sym) && data[:event] != "create"