10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# 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
}
select_options = potential[options[:keys]].zip(potential[options[:values]])
InstanceTag.new(object, method, self, options.delete(:object)).to_select_tag(select_options, options, html_options)
end
|