Restrict changed attributes to attributes that have a corresponding database column

This commit is contained in:
Josh McArthur 2013-07-02 14:18:20 +12:00
parent f25e320789
commit 4ae9a26d41
1 changed files with 1 additions and 1 deletions

View File

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