Class: Phlexi::Form::Components::InputArray
- Defined in:
- lib/phlexi/form/components/input_array.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Concerns::ExtractsInput
Methods inherited from Base
Constructor Details
This class inherits a constructor from Phlexi::Form::Components::Base
Instance Method Details
#view_template ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/phlexi/form/components/input_array.rb', line 10 def view_template div(**attributes.slice(:id, :class)) do field.repeated(values.length) do |builder| render builder.hidden_field_tag if builder.index == 0 field = builder.field( label: builder.key, # we expect key to be an integer string starting from "1" value: values[builder.index] ) if block_given? yield field else render field.input_tag end end end end |