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



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

def attributes_in_database
  super.merge(mutations_from_mobility.changed_attributes)
end

#changed_attribute_names_to_saveObject



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

def changed_attribute_names_to_save
  super + mutations_from_mobility.changed
end

#changes_to_saveObject



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

def changes_to_save
  super.merge(mutations_from_mobility.changes)
end

#has_changes_to_save?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/mobility/plugins/active_record/dirty.rb', line 100

def has_changes_to_save?
  super || mutations_from_mobility.changed?
end

#reloadObject



106
107
108
109
110
# File 'lib/mobility/plugins/active_record/dirty.rb', line 106

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

#saved_changesObject



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

def saved_changes
  super.merge(mutations_from_mobility.previous_changes)
end