Module: Mobility::Plugins::ActiveRecord::Dirty::InstanceMethods

Defined in:
lib/mobility/plugins/active_record/dirty.rb

Instance Method Summary collapse

Instance Method Details

#attributes_in_databaseObject



94
95
96
# File 'lib/mobility/plugins/active_record/dirty.rb', line 94

def attributes_in_database
  super.merge(mutations_from_mobility.changed_attributes)
end

#changed_attribute_names_to_saveObject



90
91
92
# File 'lib/mobility/plugins/active_record/dirty.rb', line 90

def changed_attribute_names_to_save
  super + mutations_from_mobility.changed
end

#changes_to_saveObject



86
87
88
# File 'lib/mobility/plugins/active_record/dirty.rb', line 86

def changes_to_save
  super.merge(mutations_from_mobility.changes)
end

#has_changes_to_save?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/mobility/plugins/active_record/dirty.rb', line 98

def has_changes_to_save?
  super || mutations_from_mobility.changed?
end

#reloadObject



102
103
104
105
106
# File 'lib/mobility/plugins/active_record/dirty.rb', line 102

def reload(*)
  super.tap do
    @mutations_from_mobility = nil
  end
end

#saved_changesObject



82
83
84
# File 'lib/mobility/plugins/active_record/dirty.rb', line 82

def saved_changes
  super.merge(mutations_from_mobility.previous_changes)
end