Sha256: 06d1935b7a0cb0354b3cd73d79a89788c74320f835c817a1fda2eb51d5e77f6b

Contents?: true

Size: 489 Bytes

Versions: 3

Compression:

Stored size: 489 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Commands
    class Create
      # 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+.
      def self.execute(doc, validate = true)
        doc.run_callbacks(:create) { Save.execute(doc, validate) }
        doc
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 lib/mongoid/commands/create.rb
mongoid-2.0.0.alpha lib/mongoid/commands/create.rb
mongoid-pre-2.0.0.pre lib/mongoid/commands/create.rb