Sha256: b903d80202ad580e6b085777a7e90b813fe1d0ca2077beafbfbc802b12679cf8
Contents?: true
Size: 641 Bytes
Versions: 11
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
11 entries across 11 versions & 4 rubygems