Sha256: 1b887ff95c9c80d8639f686a2ad45725da8603fa4ed28758548ae1cfffa1eac8
Contents?: true
Size: 526 Bytes
Versions: 2
Compression:
Stored size: 526 Bytes
Contents
module MongoMapper module Plugins module Associations class BelongsToProxy < Proxy undef_method :object_id def replace(doc) if doc doc.save if doc.new? id = doc.id end owner[association.foreign_key] = id reset end protected def find_target return nil if owner[association.foreign_key].nil? klass.find_by_id(owner[association.foreign_key]) end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
pwnash-mongo_mapper-0.7.5 | lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb |
mongo_mapper-0.7.6 | lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb |