Method: Mongoid::Dirty#setters
- Defined in:
- lib/mongoid/dirty.rb
#setters ⇒ Hash
Gets all the new values for each of the changed fields, to be passed to a MongoDB $set modifier.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/mongoid/dirty.rb', line 138 def setters mods = {} changes.each_pair do |name, changes| if changes old, new = changes field = fields[name] key = atomic_attribute_name(name) if field && field.resizable? field.add_atomic_changes(self, name, key, mods, new, old) else mods[key] = new unless atomic_unsets.include?(key) end end end mods end |