Class: TamSelectInput

Inherits:
SimpleForm::Inputs::CollectionSelectInput
  • Object
show all
Defined in:
lib/generators/tam_select/templates/tam_select_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/tam_select/templates/tam_select_input.rb', line 2

def input(wrapper_options = nil)
  attributes = merge_wrapper_options(input_html_options, wrapper_options)
  label_method, value_method = detect_collection_methods
  tam_options = attributes.delete(:tam_options) || {}
  data = attributes[:data] ||= {}
  data[:controller] = [data[:controller], "tam-select"].compact.join(" ")
  data[:tam_select_options_value] = defaults.merge(tam_options).to_json

  @builder.collection_select(
    attribute_name,
    collection,
    value_method,
    label_method,
    input_options,
    attributes
  )
end