Sha256: adbeaf4f8c21fec5dee0ed61746335f44469d6ca3d779f5e420ed4f58961ceaa

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

# encoding: UTF-8
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

1 entries across 1 versions & 1 rubygems

Version Path
mongo_mapper_ign-0.7.8 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb