module ActionView::Helpers::FormOptionsHelper

Public Instance Methods

country_select(object, method, options = {}, html_options = {}) click to toggle source
# File lib/rails_country_select.rb, line 10
def country_select(object, method, options = {}, html_options = {})
  options[:keys]    = :names unless options.has_key?(:keys)
  options[:values]  = :nums  unless options.has_key?(:values)

  potential = {
      :names   => translate_countries,
      :nums    => COUNTRY_NUMS,
      :alpha2s => COUNTRY_ALPHA2S,
      :alpha3s => COUNTRY_ALPHA3S
  }
  #options = options.delete(:object)
  select_options = potential[options[:keys]].zip(potential[options[:values]])
  select_tag("#{object}[#{method}]", options_for_select(select_options, options[:selected]),html_options)
  #Tags::Select.new(object, method, self, select_options, options, html_options)
end