Class: Interview::PolymorphicNestedForm
- Inherits:
-
NestedForm
- Object
- Control
- NestedForm
- Interview::PolymorphicNestedForm
- Defined in:
- lib/interview/controls/polymorphic_nested_form.rb
Instance Attribute Summary
Attributes inherited from NestedForm
#form_builder, #image_based, #object
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from NestedForm
Methods included from NestedBuildable
#create_nested_builder, #render_nested_builder
Methods inherited from Control
#ancestors, #build, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults
Constructor Details
This class inherits a constructor from Interview::Control
Instance Method Details
#render_nested_form(b, form_builder) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/interview/controls/polymorphic_nested_form.rb', line 4 def render_nested_form(b, form_builder) create_nested_builder(b) object = form_builder.object if klass = "#{object.class.name}NestedForm".safe_constantize nested_form = klass.new(parent: self) b << nested_form.render_nested_form(b, form_builder, &block) else super end return render_nested_builder(b) end |