Module: ActiveScaffold::Bridges::UsaStateSelect::InstanceTagMethods

Included in:
ActionView::Helpers::Tags::UsaStateSelect
Defined in:
lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb

Instance Method Summary collapse

Instance Method Details

#to_usa_state_select_tag(priority_states, options, html_options) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb', line 47

def to_usa_state_select_tag(priority_states, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  selected_value =
    if options.key?(:selected)
      options[:selected]
    else
      method(:value).parameters.any? ? value(object) : value
    end
  ('select', add_options(usa_state_options_for_select(selected_value, priority_states), options, selected_value), html_options)
end