Sha256: 7ca4167f3cab39d9acfe619804a517dc362d2613c3ba646ac073fe525e7263c4
Contents?: true
Size: 443 Bytes
Versions: 19
Compression:
Stored size: 443 Bytes
Contents
module MongoMapper 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
Version data entries
19 entries across 19 versions & 4 rubygems