Sha256: a575b4e04a30cf57156937115eec486d25eada5052cef22228db5f1e0dcc49ec

Contents?: true

Size: 591 Bytes

Versions: 11

Compression:

Stored size: 591 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    module Associations
      class ManyDocumentsAsProxy < ManyDocumentsProxy
      protected

        def criteria
          {type_key_name => proxy_owner.class.name, id_key_name => proxy_owner.id}
        end

        def apply_scope(doc)
          ensure_owner_saved
          criteria.each { |key, value| doc[key] = value }
          doc
        end

      private

        def type_key_name
          "#{options[:as]}_type"
        end

        def id_key_name
          "#{options[:as]}_id"
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mongo_mapper-0.17.0 lib/mongo_mapper/plugins/associations/proxy/many_documents_as_proxy.rb
mongo_mapper-0.16.0 lib/mongo_mapper/plugins/associations/proxy/many_documents_as_proxy.rb
mongo_mapper-0.15.6 lib/mongo_mapper/plugins/associations/proxy/many_documents_as_proxy.rb
mongo_mapper-0.15.5 lib/mongo_mapper/plugins/associations/proxy/many_documents_as_proxy.rb
mongo_mapper-0.15.4 lib/mongo_mapper/plugins/associations/proxy/many_documents_as_proxy.rb
mongo_mapper-0.15.3 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.15.2 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.15.1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.15.0 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.14.0 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb