Class: HiddenArrayInput

Inherits:
SimpleForm::Inputs::StringInput
  • Object
show all
Defined in:
app/inputs/hidden_array_input.rb

Instance Method Summary collapse

Instance Method Details

#input(_wrapper_options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/inputs/hidden_array_input.rb', line 4

def input(_wrapper_options)
  input_html_options[:type] ||= input_type

  Array(object.public_send(attribute_name)).map do |array_el|
    @builder.hidden_field(
      nil,
      input_html_options.merge(
        value: array_el,
        name: "#{object_name}[#{attribute_name}][]"
      )
    )
  end.join.html_safe
end

#input_typeObject



18
19
20
# File 'app/inputs/hidden_array_input.rb', line 18

def input_type
  :hidden
end