From 4ae9a26d41f3d8006b5eb7930911c634670e28e2 Mon Sep 17 00:00:00 2001 From: Josh McArthur Date: Tue, 2 Jul 2013 14:18:20 +1200 Subject: [PATCH] Restrict changed attributes to attributes that have a corresponding database column --- 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 57f86970f..84ba280da 100644 --- a/lib/paper_trail/has_paper_trail.rb +++ b/lib/paper_trail/has_paper_trail.rb @@ -262,7 +262,7 @@ def item_before_change end previous.tap do |prev| prev.id = id - changed_attributes.except(*self.class.paper_trail_options[:skip]).each { |attr, before| prev[attr] = before } + changed_attributes.select { |k,v| self.class.column_names.include?(k) }.each { |attr, before| prev[attr] = before } end end