This rails plugin enables you to store country info only with the country's ISO-3166 code
== ExampleTranslations are provided by the iso-codes package
class Company < ActiveRecord::Base
iso_country :country
end
c = Company.new :country => "es"
c.country # => "es"
c.country_name # => "Spain"
c.country_name = "France"
c.country # => "fr"
ISO::Countries.set_language "es"
c.country_name # => "Francia"
<% form_for @company do |f| %>
<%= f.iso_country_select :country, [:es, :en] %>
<% end %>
http://pkg-isocodes.alioth.debian.org/
http://github.com/etaque/iso_countries/tree/master
No comments:
Post a Comment