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

Version Path
mongo_mapper-0.6.6 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2009.12.4 lib/mongo_mapper/associations/many_documents_as_proxy.rb
danielharan-mongo_mapper-0.6.5 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-0.6.5 lib/mongo_mapper/associations/many_documents_as_proxy.rb
webbynode-mongo_mapper-0.6.4 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-0.6.4 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-0.6.3 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-0.6.2 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-0.6.1 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2009.11.18 lib/mongo_mapper/associations/many_documents_as_proxy.rb
mongo_mapper-0.6.0 lib/mongo_mapper/associations/many_documents_as_proxy.rb