lib/mongoid/collections.rb in mongoid-2.0.0.rc.6 vs lib/mongoid/collections.rb in mongoid-2.0.0.rc.7
- old
+ new
@@ -16,9 +16,10 @@
# document is embedded, there will be no collection associated
# with it.
#
# Returns: <tt>Mongo::Collection</tt>
def collection
+ raise Errors::InvalidCollection.new(self) if embedded? && !cyclic
self._collection || set_collection
add_indexes; self._collection
end
# Return the database associated with this collection.