mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Add tests for fixing ignored columns in versions
This commit is contained in:
parent
3d424e3dd0
commit
e4352d121a
2 changed files with 30 additions and 2 deletions
|
@ -61,8 +61,8 @@ module Versions
|
|||
preceding(time + 1, true).
|
||||
select("distinct on (item_id) #{ver_klass.table_name}.*").
|
||||
map do |ver|
|
||||
ignored_columns = ver.item_type.constantize&.ignored_columns
|
||||
o = new(ver.object&.except!(*ignored_columns))
|
||||
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]) }
|
||||
o
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue