lib/mongoid/persistable/updatable.rb
# Prepare the update for execution. Validates and runs callbacks, etc.
#
# @api private
#
# @example Prepare for update.
#   document.prepare_update do
#     collection.update(atomic_selector)
#   end
#
# @param [ Hash ] options The options.
#
# @return [ true, false ] The result of the update.
Prepare the update for execution. Validates and runs callbacks, etc.
Prepare the update for execution . Validates and runs callbacks etc .
def prepare_update(options = {})
        return false if performing_validations?(options) &&
          invalid?(options[:context] || :update)
        process_flagged_destroys
        run_callbacks(:save, with_children: false) do
          run_callbacks(:update, with_children: false) do
            run_callbacks(:persist_parent, with_children: false) do
              _mongoid_run_child_callbacks(:save) do
                _mongoid_run_child_callbacks(:update) do
                  result = yield(self)
                  post_process_persist(result, options)
                  true
                end
              end
            end
          end
        end
      end
def prepare_update ( options = { } ) return false if performing_validations? ( options ) && invalid? ( options [ :context ] || :update ) process_flagged_destroys run_callbacks ( :save , with_children : false ) do run_callbacks ( :update , with_children : false ) do run_callbacks ( :persist_parent , with_children : false ) do _mongoid_run_child_callbacks ( :save ) do _mongoid_run_child_callbacks ( :update ) do result = yield ( self ) post_process_persist ( result , options ) true end end end end end end
Prepare the update for execution.
Prepare the update for execution .
The result of the update.
The result of the update .
 true, false 
options
<not_specific>
<not_specific>
options The options.
options The options .
api
None
example
Prepare for update. document.prepare_update do collection.update(atomic_selector) end
Prepare for update . document . prepare_update do collection . update ( atomic_selector ) end