Sha256: 26b8a6ae58c21f5c2120b7c96bc6eb05f5c51763ce0a51b9c86b746d48131d4d

Contents?: true

Size: 393 Bytes

Versions: 8

Compression:

Stored size: 393 Bytes

Contents

module MongoMapper
  module Associations
    class HasManyEmbeddedProxy < ArrayProxy
      def replace(v)
        @_values = v.map { |e| e.kind_of?(EmbeddedDocument) ? e.attributes : e }
        @target = nil

        reload_target
      end

      protected
      def find_target
        (@_values || []).map do |e|
          @association.klass.new(e)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
crnixon-mongomapper-0.2.0 lib/mongomapper/associations/has_many_embedded_proxy.rb
fcoury-mongomapper-0.3.0 lib/mongomapper/associations/has_many_embedded_proxy.rb
fcoury-mongomapper-0.3.1 lib/mongomapper/associations/has_many_embedded_proxy.rb
fcoury-mongomapper-0.3.3 lib/mongomapper/associations/has_many_embedded_proxy.rb
fcoury-mongomapper-0.3.4 lib/mongomapper/associations/has_many_embedded_proxy.rb
fcoury-mongomapper-0.3.5 lib/mongomapper/associations/has_many_embedded_proxy.rb
jnunemaker-mongomapper-0.2.0 lib/mongomapper/associations/has_many_embedded_proxy.rb
ramsingla-mongomapper-0.2.1 lib/mongomapper/associations/has_many_embedded_proxy.rb