Sha256: 3646868cffe49c9d0d215ab64dcea56348a7b159ea9db15a77fde20ab1db60f4

Contents?: true

Size: 529 Bytes

Versions: 7

Compression:

Stored size: 529 Bytes

Contents

module MongoMapper
  module Plugins
    module Associations
      class ManyEmbeddedProxy < EmbeddedCollection
        def replace(values)
          @_values = values.map do |v|
            v.respond_to?(:attributes) ? v.attributes : v
          end
          reset
        end

        private
          def find_target
            (@_values || []).map do |attrs|
              klass.load(attrs).tap do |child|
                assign_references(child)
              end
            end
          end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
pwnash-mongo_mapper-0.7.5 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.7.6 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.7.5 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper_ign-0.7.4 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.7.4 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.7.3 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.7.2 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb