Sha256: fb8aa6bc6d525614168e2002a99b31925c4f5425b2062f6bf26a553706d14905

Contents?: true

Size: 630 Bytes

Versions: 62

Compression:

Stored size: 630 Bytes

Contents

module MongoMapper
  module Plugins
    module Associations
      class ManyDocumentsAsProxy < ManyDocumentsProxy
        protected
          def scoped_conditions
            {type_key_name => owner.class.name, id_key_name => owner.id}
          end

          def apply_scope(doc)
            ensure_owner_saved
            doc[type_key_name] = owner.class.name
            doc[id_key_name] = owner.id
            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

62 entries across 62 versions & 9 rubygems

Version Path
pwnash-mongo_mapper-0.7.5 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.6 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.5 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper_ign-0.7.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.3 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
numon-0.0.1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.2 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.3.8 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.3.5 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.3.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.3.3 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
drogus-mongo_mapper-0.6.10 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-rails3-0.7.0.1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.28 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.27 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.26 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.25 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.24 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb