Class: Mongoid::Identity
Overview
:nodoc:
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
-
#create ⇒ Object
Create the identity for the document.
-
#initialize(document) ⇒ Identity
constructor
Create the new identity generator - this will be expanded in the future to support pk generators.
Constructor Details
#initialize(document) ⇒ Identity
Create the new identity generator - this will be expanded in the future to support pk generators.
27 28 29 |
# File 'lib/mongoid/identity.rb', line 27 def initialize(document) @document = document end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'lib/mongoid/identity.rb', line 5 def document @document end |
Instance Method Details
#create ⇒ Object
Create the identity for the document. The id will be set in either in the form of a Mongo object id or a composite key set up by defining a key on the document. The _type will be set to the document’s class name.
14 15 16 |
# File 'lib/mongoid/identity.rb', line 14 def create identify.tap { type } end |