Merge pull request #1577 from internetee/1576-fix-removed-field-history-error

Fix presence of ignored fields in history
This commit is contained in:
Timo Võhmar 2020-04-30 12:16:19 +03:00 committed by GitHub
commit 3a93405e20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,8 @@ module Versions
valid_columns = ver.item_type.constantize&.column_names
o = new(ver.object&.slice(*valid_columns))
o.version_loader = ver
ver.object_changes.to_h.each { |k, v| o.public_send("#{k}=", v[-1]) }
changes = ver.object_changes.to_h&.slice(*valid_columns)
changes.each { |k, v| o.public_send("#{k}=", v[-1]) }
o
end
not_in_history = where(id: (ids.to_a - from_history.map(&:id)))