Class: Humanoid::Commands::Create

Inherits:
Object
  • Object
show all
Defined in:
lib/humanoid/commands/create.rb

Class Method Summary collapse

Class Method Details

.execute(doc, validate = true) ⇒ 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.



13
14
15
16
17
18
# File 'lib/humanoid/commands/create.rb', line 13

def self.execute(doc, validate = true)
  doc.run_callbacks :before_create
  Save.execute(doc, validate)
  doc.run_callbacks :after_create
  return doc
end