Module: DataMapper::Is::Audited::Resource

Defined in:
lib/dm-is-audited/is/audited/resource.rb

Instance Method Summary collapse

Instance Method Details

#changesObject



6
7
8
9
10
11
12
13
14
# File 'lib/dm-is-audited/is/audited/resource.rb', line 6

def changes
  if @audited_original_attributes
    @audited_original_attributes.merge(@audited_original_attributes) { |property, value|
      [value, attribute_get(property.name)] if attribute_get(property.name) != value
    }.delete_if {|k,v| v.nil?}
  else
    {}
  end
end