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
mongo_mapper-unstable-2010.2.23 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.22 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.19 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.18 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.17 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.16 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.15 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.12 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.11 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.10 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-0.7.0 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.9 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.8 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.5 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
novelys_mongo_mapper-0.6.12 lib/novelys_mongo_mapper/plugins/associations/many_documents_as_proxy.rb
novelys_mongo_mapper-0.6.11 lib/novelys_mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.3 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
novelys_mongo_mapper-0.6.10 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.2.2 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb