Module: Mongoid::Persistable::Settable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Mongoid::Persistable
- Defined in:
- lib/mongoid/persistable/settable.rb
Overview
Defines behaviour for $set operations.
Instance Method Summary collapse
-
#set(setters) ⇒ true
Perform a $set operation on the provided field/value pairs and set the values in the document in memory.
Instance Method Details
#set(setters) ⇒ true
Perform a $set operation on the provided field/value pairs and set the values in the document in memory.
22 23 24 25 26 27 28 29 30 |
# File 'lib/mongoid/persistable/settable.rb', line 22 def set(setters) prepare_atomic_operation do |ops| process_atomic_operations(setters) do |field, value| send("#{field}=", value) ops[atomic_attribute_name(field)] = attributes[field] end { "$set" => ops } end end |