Class: ActionView::Helpers::InstanceTag

Inherits:
Object
  • Object
show all
Includes:
FormOptionsHelper, CountryHelpers
Defined in:
lib/active_scaffold/extensions/usa_state.rb,
lib/active_scaffold/helpers/country_helpers.rb,
lib/active_scaffold/extensions/name_option_for_datetime.rb

Overview

:nodoc:

Constant Summary

Constants included from FormOptionsHelper

FormOptionsHelper::USASTATES

Instance Method Summary collapse

Methods included from FormOptionsHelper

#usa_state_options_for_select, #usa_state_select

Instance Method Details

#to_country_select_tag(priority_countries, options, html_options) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/active_scaffold/helpers/country_helpers.rb', line 301

def to_country_select_tag(priority_countries, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  selected_value = options.has_key?(:selected) ? options[:selected] : value
  ("select",
    add_options(
      country_options_for_select(selected_value, priority_countries),
      options, selected_value
    ), html_options
  )
end

#to_usa_state_select_tag(priority_states, options, html_options) ⇒ Object



38
39
40
41
42
43
# File 'lib/active_scaffold/extensions/usa_state.rb', line 38

def to_usa_state_select_tag(priority_states, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object) if method(:value).arity > 0
  ("select", add_options(usa_state_options_for_select(value, priority_states), options, value), html_options)
end