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


80
81
82
# File 'lib/mobility/plugins/active_record/dirty.rb', line 80

def attributes_in_database
  super.merge(mutations_from_mobility.changed_attributes)
end

#changed_attribute_names_to_saveObject


76
77
78
# File 'lib/mobility/plugins/active_record/dirty.rb', line 76

def changed_attribute_names_to_save
  super + mutations_from_mobility.changed
end

#changes_to_saveObject


72
73
74
# File 'lib/mobility/plugins/active_record/dirty.rb', line 72

def changes_to_save
  super.merge(mutations_from_mobility.changes)
end

#has_changes_to_save?Boolean

Returns:

  • (Boolean)

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

def has_changes_to_save?
  super || mutations_from_mobility.changed?
end

#reloadObject


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

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

#saved_changesObject


68
69
70
# File 'lib/mobility/plugins/active_record/dirty.rb', line 68

def saved_changes
  super.merge(mutations_from_mobility.previous_changes)
end