Sha256: c91f15ec0ee543403166ac6c3404445f6ead087f1f61d6670e7b61a67f0fe46f
Contents?: true
Size: 997 Bytes
Versions: 57
Compression:
Stored size: 997 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Document module ClassMethods def embeddable? false end end module InstanceMethods def new? @_new end def destroyed? @_destroyed == true end def reload if doc = collection.find_one(:_id => id) tap do |instance| instance.class.associations.each_key do |association_name| send(association_name).reset if respond_to?(association_name) end instance.attributes = doc end else raise DocumentNotFound, "Document match #{_id.inspect} does not exist in #{collection.name} collection" end end # Used by embedded docs to find root easily without if/respond_to? stuff. # Documents are always root documents. def _root_document self end end end end end
Version data entries
57 entries across 57 versions & 6 rubygems