Class: Mongoid::Commands::Create
- Defined in:
- lib/mongoid/commands/create.rb
Class Method Summary collapse
-
.execute(doc) ⇒ Object
Performs a create of the supplied Document, with the necessary callbacks.
Class Method Details
.execute(doc) ⇒ Object
Performs a create of the supplied Document, with the necessary callbacks. It then delegates to the Save command.
Options:
doc: A new Document
that is going to be persisted.
Returns: Document
.
12 13 14 15 16 17 |
# File 'lib/mongoid/commands/create.rb', line 12 def self.execute(doc) doc.run_callbacks :before_create Save.execute(doc) doc.run_callbacks :after_create return doc end |