Method: DataMapper::Resource#dirty_attributes

Defined in:
lib/dm-core/resource.rb

#dirty_attributesHash

Hash of attributes that have unsaved changes

Returns:

  • (Hash)

    attributes that have unsaved changes



603
604
605
606
607
608
609
610
611
612
# File 'lib/dm-core/resource.rb', line 603

def dirty_attributes
  dirty_attributes = {}

  original_attributes.each_key do |property|
    next unless property.respond_to?(:dump)
    dirty_attributes[property] = property.dump(property.get!(self))
  end

  dirty_attributes
end