Sha256: d068e0a78de97a7c7d5a41d1bb17f2f3e5b48d3c16adac9e4738dd6edfb5b12a

Contents?: true

Size: 620 Bytes

Versions: 6

Compression:

Stored size: 620 Bytes

Contents

# encoding: UTF-8
module MarkMapper
  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

6 entries across 6 versions & 1 rubygems

Version Path
mark_mapper-0.0.6 lib/mark_mapper/plugins/associations/many_documents_as_proxy.rb
mark_mapper-0.0.5 lib/mark_mapper/plugins/associations/many_documents_as_proxy.rb
mark_mapper-0.0.4 lib/mark_mapper/plugins/associations/many_documents_as_proxy.rb
mark_mapper-0.0.3 lib/mark_mapper/plugins/associations/many_documents_as_proxy.rb
mark_mapper-0.0.2 lib/mark_mapper/plugins/associations/many_documents_as_proxy.rb
mark_mapper-0.0.1 lib/mark_mapper/plugins/associations/many_documents_as_proxy.rb