Class: Mongoid::History::Attributes::Update

Inherits:
Base
  • Object
show all
Defined in:
lib/mongoid/history/attributes/update.rb

Instance Attribute Summary

Attributes inherited from Base

#trackable

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Mongoid::History::Attributes::Base

Instance Method Details

#attributesObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mongoid/history/attributes/update.rb', line 5

def attributes
  @attributes = {}
  changes.each do |k, v|
    if trackable_class.tracked_embeds_one?(k)
      insert_embeds_one_changes(k, v)
    elsif trackable_class.tracked_embeds_many?(k)
      insert_embeds_many_changes(k, v)
    elsif trackable_class.tracked?(k, :update)
      @attributes[k] = format_field(k, v)
    end
  end
  @attributes
end