Class: FoundationFormBuilder::Rails
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- FoundationFormBuilder::Rails
- Defined in:
- lib/foundation_form_builder/rails.rb
Instance Method Summary collapse
-
#input_div(field_name, label: nil, type: nil, values: nil, field: {}) ⇒ SafeBuffer
Renders a form field with label wrapped in an appropriate <div>, with another <div> for errors if necessary.
Instance Method Details
#input_div(field_name, label: nil, type: nil, values: nil, field: {}) ⇒ SafeBuffer
Renders a form field with label wrapped in an appropriate <div>, with another <div> for errors if necessary.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/foundation_form_builder/rails.rb', line 17 def input_div(field_name, label: nil, type: nil, values: nil, field: {}) raise ArgumentError, ':values is only meaningful with type: :select' if values && type != :select @template.content_tag :div, class: classes_for(field_name) do [ label(field_name, label), input_for(field_name, type, field, values: values), errors_for(field_name) ].compact.join("\n").html_safe end end |