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