Sha256: f599b62529d6b99b8267cb1578df4ef5d776551b7a62bf786df33c82bd1bf446
Contents?: true
Size: 492 Bytes
Versions: 10
Compression:
Stored size: 492 Bytes
Contents
module MongoMapper module Plugins module Associations class BelongsToProxy < Proxy def replace(doc) if doc doc.save if doc.new? id = doc.id end owner[reflection.foreign_key] = id reset end protected def find_target return nil if owner[reflection.foreign_key].nil? klass.first(:id => owner[reflection.foreign_key]) end end end end end
Version data entries
10 entries across 10 versions & 2 rubygems