Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Persistence::Atomic::Rename

Performs an atomic rename operation.

Public Instance Methods

persist() click to toggle source

Sends the atomic $inc operation to the database.

@example Persist the new values.

inc.persist

@return [ Object ] The new integer value.

@since 2.1.0

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.