Class: Cocooned::Association::Builder
- Inherits:
-
Object
- Object
- Cocooned::Association::Builder
- Defined in:
- lib/cocooned/association/builder.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(record, association, options = {}) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(record, association, options = {}) ⇒ Builder
Returns a new instance of Builder.
8 9 10 11 12 |
# File 'lib/cocooned/association/builder.rb', line 8 def initialize(record, association, = {}) @record = record @association = association @options = .dup.symbolize_keys.reverse_merge(force_non_association_create: false, wrap_object: false) end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
6 7 8 |
# File 'lib/cocooned/association/builder.rb', line 6 def association @association end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
6 7 8 |
# File 'lib/cocooned/association/builder.rb', line 6 def record @record end |
Instance Method Details
#build ⇒ Object
14 15 16 17 18 |
# File 'lib/cocooned/association/builder.rb', line 14 def build model = reflection ? build_with_reflection : build_without_reflection model = [:wrap_object].call(model) if [:wrap_object].respond_to?(:call) model end |