Sha256: f2d157abe60e3fb0231590152ca4adc9e4b0dd602165dcd9227cf188fa5c8908

Contents?: true

Size: 569 Bytes

Versions: 6

Compression:

Stored size: 569 Bytes

Contents

# encoding: UTF-8
module MarkMapper
  module Plugins
    module Associations
      class ManyEmbeddedProxy < EmbeddedCollection
        def replace(values)
          @_values = (values || []).compact.map do |v|
            v.respond_to?(:attributes) ? v.attributes : v
          end
          reset
        end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mark_mapper-0.0.6 lib/mark_mapper/plugins/associations/many_embedded_proxy.rb
mark_mapper-0.0.5 lib/mark_mapper/plugins/associations/many_embedded_proxy.rb
mark_mapper-0.0.4 lib/mark_mapper/plugins/associations/many_embedded_proxy.rb
mark_mapper-0.0.3 lib/mark_mapper/plugins/associations/many_embedded_proxy.rb
mark_mapper-0.0.2 lib/mark_mapper/plugins/associations/many_embedded_proxy.rb
mark_mapper-0.0.1 lib/mark_mapper/plugins/associations/many_embedded_proxy.rb