Sha256: e9d75a214e3157de52aaf7981f1b37226b219973fe4483cdfad8548d68abc178

Contents?: true

Size: 555 Bytes

Versions: 11

Compression:

Stored size: 555 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

11 entries across 11 versions & 3 rubygems

Version Path
mongo_mapper-0.12.0 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.11.2 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
jamieorc-mongo_mapper-0.11.1.1 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.11.1 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.11.0 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.10.1 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.10.0 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.9.2 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.9.1 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
mongo_mapper-0.9.0 lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb