Class: CaseForm::Element::NestedModel
- Includes:
- CaseForm::ElementExt::Associationable
- Defined in:
- lib/case_form/element/nested_model.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#method ⇒ Object
Returns the value of attribute method.
Attributes inherited from Base
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(builder, method, options = {}, &block) ⇒ NestedModel
constructor
A new instance of NestedModel.
Methods included from CaseForm::ElementExt::Associationable
#association, #association_class, #association_human_model_name, #association_method, #association_type?, #associationable?, #collection_association?, #one_to_one_association?, #specific_method, #validate_nested_attributes_association
Methods included from CaseForm::ElementExt::Naming
#object_human_model_name, #sanitized_object_name, #singularize_model_name
Constructor Details
#initialize(builder, method, options = {}, &block) ⇒ NestedModel
Returns a new instance of NestedModel.
11 12 13 14 15 |
# File 'lib/case_form/element/nested_model.rb', line 11 def initialize(builder, method, ={}, &block) @method = validate_nested_attributes_association(method, builder.object) @block = block super(builder, ) end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
9 10 11 |
# File 'lib/case_form/element/nested_model.rb', line 9 def block @block end |
#method ⇒ Object
Returns the value of attribute method.
9 10 11 |
# File 'lib/case_form/element/nested_model.rb', line 9 def method @method end |
Instance Method Details
#generate ⇒ Object
17 18 19 20 21 22 |
# File 'lib/case_form/element/nested_model.rb', line 17 def generate contents = [] contents << nested_model_contents contents << builder.new_object(method, :fields => (block.nil? ? [:fields] : block)) if allow_create? contents.join.html_safe end |