Sha256: 277d7da0a4bf1b046e2ab5a0c052c2d22f2d081b223ca99ad16d186fe46310da

Contents?: true

Size: 869 Bytes

Versions: 15

Compression:

Stored size: 869 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module Hash #:nodoc:
      module Assimilation #:nodoc:
        # Introduces a child object into the +Document+ object graph. This will
        # set up the relationships between the parent and child and update the
        # attributes of the parent +Document+.
        #
        # Options:
        #
        # parent: The +Document+ to assimilate into.
        # options: The association +Options+ for the child.
        #
        # Example:
        #
        # <tt>{:first_name => "Hank", :last_name => "Moody"}.assimilate(name, options)</tt>
        #
        # Returns: The child +Document+.
        def assimilate(parent, options)
          klass = options.klass
          child = klass.instantiate(self)
          child.assimilate(parent, options)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mongoid-0.10.6 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.10.5 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.10.4 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.10.3 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.10.2 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.10.1 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.10.0 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.12 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.11 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.10 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.9 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.8 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.7 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.6 lib/mongoid/extensions/hash/assimilation.rb
mongoid-0.9.5 lib/mongoid/extensions/hash/assimilation.rb