Sha256: 05b6441ebed3c49007eac0f7c48e024faaa682a6ecaabcf7f4aa4fb12d4afce2
Contents?: true
Size: 641 Bytes
Versions: 31
Compression:
Stored size: 641 Bytes
Contents
module MongoMapper module Associations class ManyDocumentsAsProxy < ManyDocumentsProxy protected def scoped_conditions {as_type_name => @owner.class.name, as_id_name => @owner.id} end def apply_scope(doc) ensure_owner_saved doc.send("#{as_type_name}=", @owner.class.name) doc.send("#{as_id_name}=", @owner.id) doc end def as_type_name @as_type_name ||= @association.options[:as].to_s + "_type" end def as_id_name @as_id_name ||= @association.options[:as].to_s + "_id" end end end end
Version data entries
31 entries across 31 versions & 6 rubygems