Module: Mobility::Plugins::ActiveModel::Dirty::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#changedObject



197
198
199
200
# File 'lib/mobility/plugins/active_model/dirty.rb', line 197

def changed
  # uniq is required for Rails < 6.0
  (super + mutations_from_mobility.changed).uniq
end

#changed?Boolean

Returns:

  • (Boolean)


202
203
204
# File 'lib/mobility/plugins/active_model/dirty.rb', line 202

def changed?
  super || mutations_from_mobility.changed?
end

#changed_attributesObject



184
185
186
# File 'lib/mobility/plugins/active_model/dirty.rb', line 184

def changed_attributes
  super.merge(mutations_from_mobility.changed_attributes)
end

#changesObject



193
194
195
# File 'lib/mobility/plugins/active_model/dirty.rb', line 193

def changes
  super.merge(mutations_from_mobility.changes)
end

#changes_appliedObject



188
189
190
191
# File 'lib/mobility/plugins/active_model/dirty.rb', line 188

def changes_applied
  super
  mutations_from_mobility.finalize_changes
end

#clear_attribute_changes(attr_names) ⇒ Object



215
216
217
218
# File 'lib/mobility/plugins/active_model/dirty.rb', line 215

def clear_attribute_changes(attr_names)
  attr_names.each { |attr_name| mutations_from_mobility.restore_attribute!(attr_name) }
  super
end

#clear_changes_informationObject



210
211
212
213
# File 'lib/mobility/plugins/active_model/dirty.rb', line 210

def clear_changes_information
  @mutations_from_mobility = nil
  super
end

#previous_changesObject



206
207
208
# File 'lib/mobility/plugins/active_model/dirty.rb', line 206

def previous_changes
  super.merge(mutations_from_mobility.previous_changes)
end