Module: ActionView::Helpers
- Defined in:
- lib/rails_country_select.rb
Defined Under Namespace
Modules: FormOptionsHelper Classes: FormBuilder
Instance Method Summary collapse
-
#country(options = {:name => "", :num =>"", :alpha2s => "", :alpha3s => ""}) ⇒ Object
get country info given some params.
Instance Method Details
#country(options = {:name => "", :num =>"", :alpha2s => "", :alpha3s => ""}) ⇒ Object
get country info given some params
33 34 35 36 37 38 39 40 41 |
# File 'lib/rails_country_select.rb', line 33 def country( = {:name => "", :num =>"", :alpha2s => "", :alpha3s => ""}) result = [] COUNTRY_NUMS.zip(translate_countries, COUNTRY_ALPHA2S, COUNTRY_ALPHA3S).each do |country| if [:num].to_i.eql?(country[0]) || [:name].eql?(country[1]) || [:alpha2s].eql?(country[2]) || [:alpha3s].eql?(country[3]) result = country end end result end |