Module: Super::FormBuilderHelper
- Defined in:
- lib/super/form_builder_helper.rb
Overview
These are form builder view helpers. They are similar to what Rails ships out of the box but adds some styling and functionality.
These helpers are available both in Super views and in your application's views.
Instance Method Summary collapse
-
#super_fields_for(*args, **options, &block) ⇒ Object
Super's version of
#fields_for
. -
#super_form_for(record, options = {}, &block) ⇒ Object
Super's version of
#form_for
. -
#super_form_with(**options, &block) ⇒ Object
Super's version of
#form_with
.
Instance Method Details
#super_fields_for(*args, **options, &block) ⇒ Object
Super's version of #fields_for
33 34 35 36 37 38 39 40 41 |
# File 'lib/super/form_builder_helper.rb', line 33 def super_fields_for(*args, **, &block) original = ActionView::Base.field_error_proc ActionView::Base.field_error_proc = FormBuilder::FIELD_ERROR_PROC [:builder] ||= FormBuilder fields_for(*args, **, &block) ensure ActionView::Base.field_error_proc = original end |
#super_form_for(record, options = {}, &block) ⇒ Object
Super's version of #form_for
11 12 13 14 15 16 17 18 19 |
# File 'lib/super/form_builder_helper.rb', line 11 def super_form_for(record, = {}, &block) original = ActionView::Base.field_error_proc ActionView::Base.field_error_proc = FormBuilder::FIELD_ERROR_PROC [:builder] ||= FormBuilder form_for(record, , &block) ensure ActionView::Base.field_error_proc = original end |
#super_form_with(**options, &block) ⇒ Object
Super's version of #form_with
22 23 24 25 26 27 28 29 30 |
# File 'lib/super/form_builder_helper.rb', line 22 def super_form_with(**, &block) original = ActionView::Base.field_error_proc ActionView::Base.field_error_proc = FormBuilder::FIELD_ERROR_PROC [:builder] ||= FormBuilder form_with(**, &block) ensure ActionView::Base.field_error_proc = original end |