Class: Motr::Forms::Base
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Motr::Forms::Base
- Defined in:
- lib/motr/forms/base.rb
Overview
Base class for creating form builders
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_field_type ⇒ Object
Tracks the field currently being “processed”.
-
#field_order ⇒ Object
Tracks the order in which fields are used in the form, this allows the easy rebuilding of the submitted form data when submitted since normally the hash isn’t ordered.
-
#template ⇒ Object
Access the template object.
Instance Method Summary collapse
-
#fields_for(record_or_name_or_array, *args, &block) ⇒ Object
Overrides fields_for to make sure the form builder is set properly.
Instance Attribute Details
#current_field_type ⇒ Object
Tracks the field currently being “processed”
16 17 18 |
# File 'lib/motr/forms/base.rb', line 16 def current_field_type @current_field_type end |
#field_order ⇒ Object
Tracks the order in which fields are used in the form, this allows the easy rebuilding of the submitted form data when submitted since normally the hash isn’t ordered.
14 15 16 |
# File 'lib/motr/forms/base.rb', line 14 def field_order @field_order end |
#template ⇒ Object
Access the template object
11 12 13 |
# File 'lib/motr/forms/base.rb', line 11 def template @template end |
Instance Method Details
#fields_for(record_or_name_or_array, *args, &block) ⇒ Object
Overrides fields_for to make sure the form builder is set properly
21 22 23 24 25 26 27 28 |
# File 'lib/motr/forms/base.rb', line 21 def fields_for(record_or_name_or_array, *args, &block) #:nodoc: opts = args. opts[:builder] ||= Motr::Forms.default_builder args.push(opts) Motr::Forms.with_custom_error_proc do super(record_or_name_or_array, *args, &block) end end |