Sha256: 8a8882a97b690113dd7a159285cad0d32b45f850afc31a31eb9c36606018793e

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 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 |v|
              child = klass.new(v)
              assign_root_document(child)
              child
            end
          end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
jmonteiro-mongo_mapper-0.1.1 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
jmonteiro-mongo_mapper-0.1.0 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-unstable-2010.1.12 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb