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.1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.31 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.30 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.29 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.28 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.27 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.26 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.25 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.22 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.21 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.20 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.19 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
jmonteiro-mongo_mapper-0.1.7 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.18 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
jmonteiro-mongo_mapper-0.1.6 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
jmonteiro-mongo_mapper-0.1.5 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
mongo_mapper-unstable-2010.1.17 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
jmonteiro-mongo_mapper-0.1.4 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
jmonteiro-mongo_mapper-0.1.2 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
jmonteiro-mongo_mapper-0.1.1 lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb