From d95de0906c1d1c0a5ea07ad9c258f5755feb2e6d Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Tue, 7 Mar 2017 13:23:51 -0500 Subject: [PATCH] Fix error calling private method in rails 4.0 --- CHANGELOG.md | 2 ++ lib/paper_trail/record_trail.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8641abe5..f80bf631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/). - [#925](https://github.com/airblade/paper_trail/pull/925) - Update RSpec matchers to work with custom version association names +- [#929](https://github.com/airblade/paper_trail/pull/929) - + Fix error calling private method in rails 4.0 ## 6.0.2 (2016-12-13) diff --git a/lib/paper_trail/record_trail.rb b/lib/paper_trail/record_trail.rb index cec29cfe..b0f5f97e 100644 --- a/lib/paper_trail/record_trail.rb +++ b/lib/paper_trail/record_trail.rb @@ -474,7 +474,9 @@ module PaperTrail if @in_after_callback && RAILS_GTE_5_1 @record.attribute_before_last_save(attr_name.to_s) else - @record.attribute_was(attr_name.to_s) + # TODO: after dropping support for rails 4.0, remove send, because + # attribute_was is no longer private. + @record.send(:attribute_was, attr_name.to_s) end end