Module: GenericFormFor::Helpers::FormHelper
- Included in:
- FormBuilder
- Defined in:
- lib/generic_form_for/helpers/form_helper.rb
Overview
FormHelper is a wrapper around Rails’ built-in form helper
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#autofocus ⇒ Object
Returns the value of attribute autofocus.
-
#proc ⇒ Object
Returns the value of attribute proc.
-
#record ⇒ Object
Returns the value of attribute record.
Instance Method Summary collapse
- #generic_fields_for(name, *args, &proc) ⇒ Object
-
#generic_form_for(record, *args, &proc) ⇒ Object
generic_form_for @post, :html => => true do |f| ..form content Behaves the same as form form.
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
9 10 11 |
# File 'lib/generic_form_for/helpers/form_helper.rb', line 9 def args @args end |
#autofocus ⇒ Object
Returns the value of attribute autofocus.
8 9 10 |
# File 'lib/generic_form_for/helpers/form_helper.rb', line 8 def autofocus @autofocus end |
#proc ⇒ Object
Returns the value of attribute proc.
9 10 11 |
# File 'lib/generic_form_for/helpers/form_helper.rb', line 9 def proc @proc end |
#record ⇒ Object
Returns the value of attribute record.
9 10 11 |
# File 'lib/generic_form_for/helpers/form_helper.rb', line 9 def record @record end |
Instance Method Details
#generic_fields_for(name, *args, &proc) ⇒ Object
26 27 28 29 30 |
# File 'lib/generic_form_for/helpers/form_helper.rb', line 26 def generic_fields_for(name, *args, &proc) = args.last.is_a?(Hash) ? args.pop : {} [:builder] ||= GenericFormFor::FormBuilder fields_for(name, *(args << ), &proc) end |
#generic_form_for(record, *args, &proc) ⇒ Object
generic_form_for @post, :html => => true do |f|
..form content Behaves the same as form form. Adittional options:
autofocus: false - will tur off autofocus for this form
by default autofocus is on and will set autofocus attribute to first visible element
17 18 19 20 21 22 23 24 |
# File 'lib/generic_form_for/helpers/form_helper.rb', line 17 def generic_form_for(record, *args, &proc) = args.last.is_a?(Hash) ? args.pop : {} [:builder] ||= GenericFormFor::FormBuilder self.builder = [:builder] [:html] ||= {} self.record, self.args, self.proc = record, *(args << ), proc instance_exec &builder.form_wrapper_proc end |