Sha256: d73e85ac128ca939c6edaf58cbfc3ffefaef2888d6106454f52db1e154871e8b

Contents?: true

Size: 621 Bytes

Versions: 75

Compression:

Stored size: 621 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

75 entries across 75 versions & 9 rubygems

Version Path
mongo_mapper-0.8.5 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
honkster-mongo_mapper-0.8.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.8.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.19 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.18 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.17 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.16 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.15 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.14 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.13 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.12 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.11 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.10 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.09 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.8.3 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.08 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.06 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.05 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.04 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.08.03 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb