Method: Mongoid::Collections::ClassMethods#collection
- Defined in:
- lib/mongoid/collections.rb
#collection ⇒ Object
Returns the collection associated with this Document. If the document is embedded, there will be no collection associated with it.
Returns: Mongo::Collection
19 20 21 22 23 |
# File 'lib/mongoid/collections.rb', line 19 def collection raise Errors::InvalidCollection.new(self) if self._collection || set_collection add_indexes; self._collection end |