Sha256: 6e227e1b2cda3c8c06d96a1eda76383324a1b38ee8c2b025a82e40bd3e63afc2
Contents?: true
Size: 974 Bytes
Versions: 6
Compression:
Stored size: 974 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Document extend ActiveSupport::Concern module ClassMethods def embeddable? false end end def new? !!(@_new ||= false) end def destroyed? !!(@_destroyed ||= false) end def reload if doc = collection.find_one(:_id => id) self.class.associations.each_value do |association| get_proxy(association).reset end instance_variables.each { |ivar| remove_instance_variable(ivar) } initialize_from_database(doc) self 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
Version data entries
6 entries across 6 versions & 1 rubygems