Module: ActiveScaffold::Bridges::CountryHelper::CountryHelpers

Defined in:
lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb

Instance Method Summary collapse

Instance Method Details

#country_select(object, method, priority_countries = nil, options = {}, html_options = {}) ⇒ Object

Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.



15
16
17
# File 'lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb', line 15

def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
  country_select_class.new(object, method, self, country_select_options(options)).to_country_select_tag(priority_countries, options, html_options)
end

#country_select_classObject



4
5
6
7
# File 'lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb', line 4

def country_select_class
  # TODO remove when rails 3.2 support is dropped
  defined?(ActionView::Helpers::InstanceTag) ? ActionView::Helpers::InstanceTag : ActionView::Helpers::Tags::CountrySelect
end

#country_select_options(options) ⇒ Object



9
10
11
12
# File 'lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb', line 9

def country_select_options(options)
  # TODO remove when rails 3.2 support is dropped
  defined?(ActionView::Helpers::InstanceTag) ? options[:object] : options
end

#usa_state_select(object, method, priority_states = nil, options = {}, html_options = {}) ⇒ Object



19
20
21
# File 'lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb', line 19

def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
  country_select_class.new(object, method, self, country_select_options(options)).to_usa_state_select_tag(priority_states, options, html_options)
end