Merge remote-tracking branch 'origin/108869472-objects_archive' into story/115762063--show-historical-nested

# Conflicts:
#	app/views/admin/domain_versions/_version.haml
#	app/views/admin/domain_versions/index.haml
This commit is contained in:
Vladimir Krylov 2016-03-22 23:51:21 +02:00
parent 5a582d872d
commit ffe2ddd02c
3 changed files with 50 additions and 39 deletions

View file

@ -3,6 +3,7 @@ module Versions
extend ActiveSupport::Concern
included do
attr_accessor :version_loader
has_paper_trail class_name: "#{model_name}Version"
# add creator and updator
@ -65,6 +66,7 @@ module Versions
select("distinct on (item_id) #{ver_klass.table_name}.*").
map do |ver|
o = new(ver.object)
o.version_loader = ver
ver.object_changes.to_h.each { |k, v| o[k]=v[-1] }
o
end