Sha256: 85d8f4667366161399286f9d635cef2f5d9ad638d81c7dee0437189bd9d54c50
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Mongoid module History module Attributes class Destroy < ::Mongoid::History::Attributes::Base def attributes @attributes = {} trackable.attributes.each { |k, v| @attributes[k] = [format_field(k, v), nil] if trackable_class.tracked_field?(k, :destroy) } insert_embeds_one_changes insert_embeds_many_changes @attributes end private def insert_embeds_one_changes trackable_class.tracked_embeds_one .map { |rel| aliased_fields.key(rel) || rel } .each do |rel| obj = trackable.send(rel) @attributes[rel] = [format_embeds_one_relation(rel, obj.attributes), nil] if obj end end def insert_embeds_many_changes trackable_class.tracked_embeds_many .map { |rel| aliased_fields.key(rel) || rel } .each do |rel| @attributes[rel] = [trackable.send(rel).map { |obj| format_embeds_many_relation(rel, obj.attributes) }, nil] end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-history-0.8.5 | lib/mongoid/history/attributes/destroy.rb |