Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Persistence::Atomic::Sets

This class provides atomic $set behaviour.

Public Instance Methods

persist() click to toggle source

Sends the atomic $set operation to the database.

@example Persist the new values.

set.persist

@return [ Object ] The new field value.

@ssete 2.0.0

# File lib/mongoid/persistence/atomic/sets.rb, line 17
def persist
  prepare do
    value ? document[field] = value : @value = document[field]
    document[field].tap do
      collection.update(document.atomic_selector, operation("$set"), options)
      document.remove_change(field)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.