Module: StimulusPlumbers::Form::Fields::Select

Included in:
Builder
Defined in:
lib/stimulus_plumbers/form/fields/select.rb

Instance Method Summary collapse

Instance Method Details

#collection_select(attribute, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/stimulus_plumbers/form/fields/select.rb', line 14

def collection_select(attribute, collection, value_method, text_method,
                      options = {}, html_options = {})
  rails_opts, form_field_opts = extract_options(options)
  field     = build_field(attribute, form_field_opts)
  html_opts = merge_html_options(html_options, field_theme(:form_select, error: field.error?), field.html_opts)
  render_field(
    field,
    super(attribute, collection, value_method, text_method, rails_opts, html_opts)
  )
end

#select(attribute, choices = nil, options = {}, html_options = {}) ⇒ Object



7
8
9
10
11
12
# File 'lib/stimulus_plumbers/form/fields/select.rb', line 7

def select(attribute, choices = nil, options = {}, html_options = {})
  rails_opts, form_field_opts = extract_options(options)
  field     = build_field(attribute, form_field_opts)
  html_opts = merge_html_options(html_options, field_theme(:form_select, error: field.error?), field.html_opts)
  render_field(field, super(attribute, choices, rails_opts, html_opts))
end