Class: Interview::Form
- Includes:
- HasHtmlOptions, NestedBuildable
- Defined in:
- lib/interview/controls/form.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#form_builder ⇒ Object
readonly
Returns the value of attribute form_builder.
-
#object ⇒ Object
Returns the value of attribute object.
-
#redirect_to ⇒ Object
Returns the value of attribute redirect_to.
Attributes included from HasHtmlOptions
Attributes inherited from Control
Instance Method Summary collapse
Methods included from HasHtmlOptions
Methods included from NestedBuildable
#create_nested_builder, #render_nested_builder
Methods inherited from Control
#ancestors, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults
Instance Attribute Details
#form_builder ⇒ Object (readonly)
Returns the value of attribute form_builder.
7 8 9 |
# File 'lib/interview/controls/form.rb', line 7 def form_builder @form_builder end |
#object ⇒ Object
Returns the value of attribute object.
6 7 8 |
# File 'lib/interview/controls/form.rb', line 6 def object @object end |
#redirect_to ⇒ Object
Returns the value of attribute redirect_to.
6 7 8 |
# File 'lib/interview/controls/form.rb', line 6 def redirect_to @redirect_to end |
Instance Method Details
#build(b) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/interview/controls/form.rb', line 9 def build(b) object = @object || find_attribute!(:object) b << h.form_for(object, role: 'form', html: ) do |form_builder| @form_builder = form_builder create_nested_builder(b) b.form_errors build_default_controls(b) yield if block_given? render_nested_builder(b) end end |