Method: Mongoid::Contextual::Memory#update

Defined in:
lib/mongoid/contextual/memory.rb

#update(attributes = nil) ⇒ nil | false

Update the first matching document atomically.

Examples:

Update the matching document.

context.update(name: "Smiths")

Parameters:

  • attributes (Hash) (defaults to: nil)

    The new attributes for the document.

Returns:

  • (nil | false)

    False if no attributes were provided.



360
361
362
# File 'lib/mongoid/contextual/memory.rb', line 360

def update(attributes = nil)
  update_documents(attributes, [ first ])
end