Module: Formula::FormulaFormHelper
- Defined in:
- lib/formula.rb
Constant Summary collapse
- @@builder =
::Formula::FormulaFormBuilder
Instance Method Summary collapse
-
#formula_fields_for(record_or_name_or_array, *args, &block) ⇒ Object
(also: #fieldsula_for)
Generates a wrapper around fields_for with :builder set to FormulaFormBuilder.
-
#formula_form_for(record_or_name_or_array, *args, &proc) ⇒ Object
(also: #formula_for)
Generates a wrapper around form_for with :builder set to FormulaFormBuilder.
Instance Method Details
#formula_fields_for(record_or_name_or_array, *args, &block) ⇒ Object Also known as: fieldsula_for
Generates a wrapper around fields_for with :builder set to FormulaFormBuilder.
Supports:
-
f.formula_fields_for(@user.company)
-
f.fieldsula_for(@user.company)
Equivalent:
-
f.fields_for(@user.company, :builder => Formula::FormulaFormBuilder))
Usage:
<% f.formula_fields_for(@user.company) do |company_f| %>
<%= company_f.input :url %>
<%= company_f.input :phone %>
<% end %>
493 494 495 496 497 |
# File 'lib/formula.rb', line 493 def formula_fields_for(record_or_name_or_array, *args, &block) = args. [:builder] ||= @@builder fields_for(record_or_name_or_array, *(args << ), &block) end |
#formula_form_for(record_or_name_or_array, *args, &proc) ⇒ Object Also known as: formula_for
Generates a wrapper around form_for with :builder set to FormulaFormBuilder.
Supports:
-
formula_form_for(@user)
Equivalent:
-
form_for(@user, :builder => Formula::FormulaFormBuilder))
Usage:
<% formula_form_for(@user) do |f| %>
<%= f.input :email %>
<%= f.input :password %>
<% end %>
466 467 468 469 470 |
# File 'lib/formula.rb', line 466 def formula_form_for(record_or_name_or_array, *args, &proc) = args. [:builder] ||= @@builder form_for(record_or_name_or_array, *(args << ), &proc) end |