Module: Mongoid::Association::Embedded::EmbeddedIn::Buildable
- Includes:
- Threaded::Lifecycle
- Included in:
- Mongoid::Association::Embedded::EmbeddedIn
- Defined in:
- lib/mongoid/association/embedded/embedded_in/buildable.rb
Overview
The Builder behavior for embedded_in associations.
Instance Method Summary collapse
-
#build(base, object, type = nil, selected_fields = nil) ⇒ Document
This builder doesn’t actually build anything, just returns the parent since it should already be instantiated.
Instance Method Details
#build(base, object, type = nil, selected_fields = nil) ⇒ Document
This builder doesn’t actually build anything, just returns the parent since it should already be instantiated.
27 28 29 30 31 32 33 34 |
# File 'lib/mongoid/association/embedded/embedded_in/buildable.rb', line 27 def build(base, object, type = nil, selected_fields = nil) return object unless object.is_a?(Hash) if _loading? Factory.from_db(klass, object, nil, selected_fields) else Factory.build(klass, object) end end |