class 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)
    execute("$rename")
    document.remove_change(value)
    document[value]
  end
end