Module Mongoid::Factory
In: lib/mongoid/factory.rb

Instantiates documents that came from the database.

Methods

build   from_db  

Public Instance methods

Builds a new Document from the supplied attributes.

@example Build the document.

  Mongoid::Factory.build(Person, { "name" => "Durran" })

@param [ Class ] klass The class to instantiate from if _type is not present. @param [ Hash ] attributes The document attributes. @param [ Hash ] optiosn The mass assignment scoping options.

@return [ Document ] The instantiated document.

Builds a new Document from the supplied attributes loaded from the database.

@example Build the document.

  Mongoid::Factory.from_db(Person, { "name" => "Durran" })

@param [ Class ] klass The class to instantiate from if _type is not present. @param [ Hash ] attributes The document attributes.

@return [ Document ] The instantiated document.

[Validate]