Giter Site home page Giter Site logo

country_select's Introduction

Countries

Countries is a collection of all sorts of useful information for every country in the ISO 3166 standard. It contains info for the following standards ISO3166-1 (countries), ISO3166-2 (states/subdivisions), ISO4217 (currency) and E.164 (phone numbers).

The data used in this gem is also available as git submodules in YAML and JSON files.

Gem Version Tests Code Climate CodeQL

Installation

 gem install countries

Or you can install via Bundler if you are using Rails:

bundle add countries

Basic Usage

Simply load a new country object using Country.new(alpha2) or the shortcut Country[alpha2]. An example works best.

c = ISO3166::Country.new('US')

Get all country codes (alpha2).

ISO3166::Country.codes
#  ["TJ", "JM", "HT",...]

Configuration

Country Helper

Some apps might not want to constantly call ISO3166::Country this gem has a helper that can provide a Country class

# With global Country Helper
c = Country['US']

This will conflict with any existing Country constant

To Use

gem 'countries', require: 'countries/global'

Upgrading to 4.2 and 5.x

Release 4.2.0 introduced changes to name attributes and finders and deprecated several methods to resolve some existing confusion regardign official ISO country names vs. the "common names" that are commonly used.

The 5.0 release removed these deprecated methods and also removed support for Ruby 2.5 and 2.6

Plase see UPGRADE.md for more information

Attribute-Based Finder Methods

You can lookup a country or an array of countries using any of the data attributes via the find_country_by_attribute dynamic methods:

c    = ISO3166::Country.find_country_by_iso_short_name('italy')
c    = ISO3166::Country.find_country_by_any_name('united states')
h    = ISO3166::Country.find_all_by(:translated_names, 'França')
list = ISO3166::Country.find_all_countries_by_region('Americas')
c    = ISO3166::Country.find_country_by_alpha2("FR")

For a list of available attributes please see ISO3166::DEFAULT_COUNTRY_HASH. Note: searches are case insensitive and ignore accents.

Please note that find_by_name, find_by_names, find_*_by_name and find_*_by_names methods were removed in 5.0. See UPGRADE.md for more information

Country Info

Identification Codes

c.number # => "840"
c.alpha2 # => "US"
c.alpha3 # => "USA"
c.gec    # => "US"

Names & Translations

c.iso_long_name # => "The United States of America"
c.iso_short_name # => "United States of America"
c.common_name # => "United States" (This is a shortcut for c.translations('en'))
c.unofficial_names # => ["United States of America", "Vereinigte Staaten von Amerika", "États-Unis", "Estados Unidos"]

# Get the names for a country translated to its local languages
c = Country[:BE]
c.local_names # => ["België", "Belgique", "Belgien"]
c.local_name # => "België"

# Get a specific translation
c.translation('de') # => 'Vereinigte Staaten von Amerika'
c.translations['fr'] # => "États-Unis"

# Get all translations for a locale, defaults to 'en'
ISO3166::Country.translations         # {"DE"=>"Germany",...}
ISO3166::Country.translations('de')   # {"DE"=>"Deutschland",...}
ISO3166::Country.all_translated       # ['Germany', ...]
ISO3166::Country.all_translated('de') # ['Deutschland', ...]

# Nationality
c.nationality # => "American"

Subdivisions & States

c.subdivisions # => {"CO" => {"name" => "Colorado", "names" => "Colorado"}, ... }
c.subdivision_types # => ["state", "outlying_area", "district"]
c.subdivisions_of_types(['state']) # => {"CO" => {"name" => "Colorado", "names" => "Colorado"}, ... }
c.humanized_subdivision_types # => ["State", "Outlying area", "District"]

# This is now deprecated. #states is an alias of #subdivisions and returns all subdivisions regardless of type
c.states # => {"CO" => {"name" => "Colorado", "names" => "Colorado"}, ... }


# Get specific translations for the country subdivisions
c.subdivision_names_with_codes('es') #=> [ ..., ["Nuevo Hampshire", "NH"], ["Nueva Jersey", "NJ"], ... ]

# Subdivision code with translations for all loaded locales
c.subdivisions['NY'].code_with_translations #=> {"NY"=>{"en"=>"New York"}, ...}

#find_subdivision_by_name Find a country's state using its code or name in any translation

> ISO3166::Country.new("IT").find_subdivision_by_name("Toscana").geo
 => {"latitude"=>43.771389, "longitude"=>11.254167, ... }
> ISO3166::Country.new("IT").find_subdivision_by_name("Tuscany").geo
 => {"latitude"=>43.771389, "longitude"=>11.254167, ... }

Location

c.latitude # => "37.09024"
c.longitude # => "-95.712891"

c.world_region # => "AMER"
c.region # => "Americas"
c.subregion # => "Northern America"

Please note that latitude_dec and longitude_dec were deprecated on release 4.2 and removed in 5.0. These attributes have been redundant for several years, since the latitude and longitude fields have been switched decimal coordinates.

Timezones (optional)

Add tzinfo to your Gemfile and ensure it's required, Countries will not do this for you.

gem 'tzinfo', '~> 1.2', '>= 1.2.2'
c.timezones.zone_identifiers # => ["America/New_York", "America/Detroit", "America/Kentucky/Louisville", ...]
c.timezones.zone_info  # see [tzinfo docs](https://www.rubydoc.info/gems/tzinfo/TZInfo/CountryTimezone)
c.timezones # see [tzinfo docs](https://www.rubydoc.info/gems/tzinfo/TZInfo/Country)

Telephone Routing (E164)

c.country_code # => "1"
c.national_destination_code_lengths # => 3
c.national_number_lengths # => 10
c.international_prefix # => "011"
c.national_prefix # => "1"

Boundary Boxes

c.min_longitude # => '45'
c.min_latitude # => '22.166667'
c.max_longitude # => '58'
c.max_latitude # => '26.133333'

c.bounds #> {"northeast"=>{"lat"=>22.166667, "lng"=>58}, "southwest"=>{"lat"=>26.133333, "lng"=>45}}

European Union Membership

c.in_eu? # => false

European Economic Area Membership

c.in_eea? # => false

European Single Market Membership

c.in_esm? # => false

EU VAT Area membership

c.in_eu_vat? # => false

GDPR Compliant (European Economic Area Membership or UK)

c.gdpr_compliant? # => false

Country Code in Emoji

c = Country['MY']
c.emoji_flag # => "🇲🇾"

Country Distance Unit (miles/kilometres)

c.distance_unit # => "MI"

Plucking multiple attributes

ISO3166::Country.pluck(:alpha2, :iso_short_name) # => [["AD", "Andorra"], ["AE", "United Arab Emirates"], ...

.collect_countries_with allows to collect various countries' informations using any valid method and query value:

> ISO3166::Country.collect_countries_with("VR",:subdivisions,:common_name)
 => ["Italy", "Monaco"]
> ISO3166::Country.collect_countries_with("Caribbean",:subregion,:languages_spoken).flatten.uniq
 => ["en", "fr", "es", "ht", "nl"]
> ISO3166::Country.collect_countries_with("Oceania",:region,:international_prefix).uniq
 => ["00", "011", "0011", "19", "05"]
> ISO3166::Country.collect_countries_with("Antarctica",:continent,:emoji_flag)
 => ["🇦🇶", "🇬🇸", "🇧🇻", "🇹🇫", "🇭🇲"]
> ISO3166::Country.collect_countries_with("🇸🇨",:emoji_flag,:common_name)
 => ["Seychelles"]

.collect_likely_countries_by_subdivision_name allows to lookup all countries having the given state code or state name (in any translation)

ISO3166::Country.collect_likely_countries_by_subdivision_name("San José",:common_name)
 => ["Costa Rica", "Uruguay"]

Conversions

ISO3166::Country.from_alpha3_to_alpha2('USA') # => "US"
ISO3166::Country.from_alpha2_to_alpha3('US') # => "USA"

ISO3166::Country.from_alpha2_to_alpha3('--') # => nil

Currencies

To enable currencies extension please add the following to countries initializer.

ISO3166.configuration.enable_currency_extension!

Please note that it requires you to add "money" dependency to your gemfile.

gem "money", "~> 6.9"

Countries now uses the Money gem. What this means is you now get back a Money::Currency object that gives you access to all the currency information.

c = ISO3166::Country['us']
c.currency.iso_code # => 'USD'
c.currency.name # => 'United States Dollar'
c.currency.symbol # => '$'

Address Formatting

A template for formatting addresses is available through the address_format method. These templates are compatible with the Liquid template system.

c.address_format # => "{{recipient}}\n{{street}}\n{{city}} {{region}} {{postalcode}}\n{{country}}"

Selective Loading of Locales

As of 2.0 you can selectively load locales to reduce memory usage in production.

By default we load I18n.available_locales if I18n is present, otherwise only [:en]. This means almost any Rails environment will only bring in its supported translations.

You can add all the locales like this.

ISO3166.configure do |config|
  config.locales = [:af, :am, :ar, :as, :az, :be, :bg, :bn, :br, :bs, :ca, :cs, :cy, :da, :de, :dz, :el, :en, :eo, :es, :et, :eu, :fa, :fi, :fo, :fr, :ga, :gl, :gu, :he, :hi, :hr, :hu, :hy, :ia, :id, :is, :it, :ja, :ka, :kk, :km, :kn, :ko, :ku, :lt, :lv, :mi, :mk, :ml, :mn, :mr, :ms, :mt, :nb, :ne, :nl, :nn, :oc, :or, :pa, :pl, :ps, :pt, :"pt-BR", :ro, :ru, :rw, :si, :sk, :sl, :so, :sq, :sr, :sv, :sw, :ta, :te, :th, :ti, :tk, :tl, :tr, :tt, :ug, :uk, :ve, :vi, :wa, :wo, :xh, :"zh-cn", :"zh-tw", :zu]
end

or something a bit more simple

ISO3166.configure do |config|
  config.locales = [:en, :de, :fr, :es]
end

If you change the value of ISO3166.configuration.locales after initialization, you should call ISO3166::Data.reset to reset the data cache, or you may end up with inconsistently loaded locales. As of 5.1.1, subdivision translations also respect this and will only load the selected locales.

Loading Custom Data

As of 2.0 countries supports loading custom countries / overriding data in its data set, though if you choose to do this please contribute back to the upstream repo!

Any country registered this way will have its data available for searching etc... If you are overriding an existing country, for cultural reasons, our code uses a simple merge, not a deep merge so you will need to bring in all data you wish to be available. Bringing in an existing country will also remove it from the internal management of translations, all registered countries will remain in memory.

ISO3166::Data.register(
  alpha2: 'LOL',
  iso_short_name: 'Happy Country',
  translations: {
    'en' => 'Happy Country',
    'de' => 'glückliches Land'
  }
)

ISO3166::Country.new('LOL').iso_short_name == 'Happy Country'

Mongoid

Mongoid support has been added. It is required automatically if Mongoid is defined in your project.

Use native country fields in your model:

field :country, type: Country

Adds native support for searching/saving by a country object or alpha2 code.

Searching:

# By alpha2
spanish_things = Things.where(country: 'ES')
spanish_things.first.country.iso_short_name    # => "Spain"

# By object
spanish_things = Things.where(country: Country.find_by_iso_short_name('Spain')[1])
spanish_things.first.country.iso_short_name    # => "Spain"

Saving:

# By alpha2
spanish_things = Thing.new(country: 'ES')
spanish_things.save!
spanish_things.country.iso_short_name    # => "Spain"

# By object
spanish_things = Thing.new(country: Country.find_by_iso_short_name('Spain')[1])
spanish_things.save!
spanish_things.country.iso_short_name    # => "Spain"

Note that the database stores only the alpha2 code and rebuilds the object when queried. To return the country name by default you can override the reader method in your model:

def country
  super.iso_short_name
end

Note on Patches/Pull Requests

Please do not submit pull requests on cache/**/*. These files generated by a rake task when preparing new releases and are not meant to be manually updated.

If you with to submit a PR to update or correct country data, please edit the corresponding YAML file lib/countries/data/**. Changes to the YAML files will be injected during the next rake update_cache.

This project seeks to follow ISO3166, ISO4217 and E.164 standards in its data.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Copyright

Copyright (c) 2012-2015 hexorx
Copyright (c) 2015-2021 hexorx, rposborne
Copyright (c) 2022 hexorx, rposborne, pmor

See LICENSE for details.

country_select's People

Contributors

auzroz avatar barrywoolgar avatar henrik avatar j0an avatar jjballano avatar jnajera avatar joemsak avatar joshgoebel avatar kennethkalmer avatar lenart avatar michaelem avatar mikepluquin avatar mikerogers0 avatar mschmidt avatar nicolasleger avatar nzkoz avatar oliverklee avatar olleolleolle avatar p-wall avatar paolodona avatar petergoldstein avatar pmor avatar pwim avatar romaingweb avatar ron-shinall avatar rposborne avatar scudco avatar sreuterle avatar stefanpenner avatar zarqman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

country_select's Issues

Bump to 1.0.0

This gem is probably exactly as you imagined and stable.

country names as values in rails 3.2

Hi,

i'm getting country names in both name and value at select options, also does not understand the priority codes given.

<%= country_select 'sale[shipment_attributes][shipment_datum_attributes]', :country, ['es', 'us'] %>

i'm using rails 3.2.11 ruby 1.9.3

  • countries (0.9.2)
  • country_select (1.1.3)

any idea?

Localization

Hello!

What you can say about translation this list to another languages?

I.E., I'll add ru.yml with Russian names of countries, and english files will move to the en.yml?

Regards,
Alex

Country definition in wrong case

Based on what I have seen with Countries and other Ruby Gems, it looks like the Alpha2 code should be in upper case and not lower. This is causing compatibility issues with other gems. (Countries, Phony Rails)

Use countries from hexorx/countries?

We have a forked version of hexorx/countries which adds a few subdivisions as primary countries. It says in the readme for that gem, that it integrates with this gem, however this gem seems to ignore our custom list of countries.

It would be great if this read the list of countries from hexorx/countries (if available) so that we don't have to fork both projects.

empty records possible?

Is there the possibility to provide an empty option?
Maybe with personalized text?

For example

  • select a country - nil
  • Afghanistan - AF
  • Germany - DE
  • ...
  • ..
  • .

Many thanks

only: ... can we also get except:

I have a small list of countries I have to exclude... can't figure out how to do it other than forking and modifying the master list. only: would work - just a +1 for except: ['sy','sd'... etc...]
Thanks

country_select with nil name still render a name

I have a stripe powered form, most of the fields are presented without name as expected. country_select however insert empty brackets for its name, causing it to get pulled up.

<%= country_select nil, nil, { selected: 'US' }, { 'data-stripe' => 'address_country', autocomplete: 'billing country', class: 'country form-control', required: true } %>
<select data-stripe="address_country" autocomplete="billing country" class="country form-control" required="required" name="[]" id="_" data-bv-field="[]"></select>

Warning on rails console after installing country_select

I get the following warning after installing this gem when I use rails console:

precise32% rails c
/home/vagrant/.rvm/gems/ruby-2.1.2/gems/countries-0.9.3/lib/iso3166.rb:7: warning: already initialized constant ActionView::Helpers::FormOptionsHelper::COUNTRIES
/home/vagrant/.rvm/gems/ruby-2.1.2/gems/country-select-1.1.1/lib/country-select.rb:36: warning: previous definition of COUNTRIES was here
Loading development environment (Rails 4.1.6)

russian locale

countries gem contains russian locale (ru), why is it not working with country_select?

Add a class to select input

Hi, I've been trying to add a class to the input like so: country_select("location", "country_code", class: "form-control") but with no luck. What am I doing wrong?

Make country names consistent

Excellent gem, but the names of the countries should either be in the native tongue or all in English. Côte d'Ivoire is a good example, it should read Ivory Coast.

Should I correct as many as possible and submit a pull request for this?

undefined method `first' for nil:NilClass

Getting this error on this line:

/lib/country_select/tag_helper.rb:  68:in `block (2 levels) in country_options_for'

I have just introduced using i18n in my application, perhaps related?

Upgrade countries gem dependency

Hi.

I just tried to use country_select with the countries gem version 0.10 (released Jan 23, 2015). Now, when a view tries to use the country_select helper the rendering process seems to hang for about 45 seconds on my machine and afterwards renders the template and select-box (filled with countries) flawlessly.

Does anything have an idea for the reason and where to look for this problem? I was not able to trace down the reason for this yet. Maybe anybody has a rough idea where to look for the problem?

Countries now show as ISO code

Hi,

I'm using simple_form in conjunction with country_select.

I have country_select locked to version 1.1.3 and simple_form locked to version 3.0.1, using Rails 4.0.3

The issue is that the countries display as full country names in the development environment and have recently started displaying as ISO codes in our staging and production environments.

Since the version of the gems are locked to a particular version in the Gemfile, how is it that the behavior has changed? The note you added for people from 1.x doesn't apply to our use case since we are in fact using 1.1.3 everywhere (as shown by bundle show country_select).

Customizable display value

Looking for input on how others may use this feature. I currently need to be able to display the country name and International Phone Prefix in the dropdown. i.e. (United States - (+1))

I think given the right parameters, I might be able to make Feature Request #27 work with this as well.

Perhaps something like this:

country_select("user", "country_code", [ "GB", "FR", "DE" ], iso_codes: true, language: "fr", display_template: "#{name} - (#{national_prefix})")

Thoughts?

cannot set prompt and include_blank for rails < 4 - rails 3.2.19

This bit of code seems to be ignoring "options" hence when you pass in e.g. {prompt: 'Please select country', include_blank: true} these options are ignored

lib/country_select/rails3/country_select_helper.rb - line 25 to 36

Can anyone help me with this?

country_select save name as value

is there any way I can save the name as the value or disply name in the view when showing the Country name in the user profile.
Thank you

Allow for option to use uppercase country codes

Would it be possible to add the feature in the 1.0 branch, similar to the way one can indicated iso_codes: true as an option, would something like iso_codes_uppercase: true be an valid fix, until we can use the 2.0 branch?

Alternatively, is the 2.0 branch stable enough that I can use it instead? (i'm using it in conjunction with simple_form gem).

Regression: Incompatible code changes

The new version 1.3.0 has a serious compatibility issue - country codes are saved in uppercase now (e.g. "US" instead of "us") and this is breaking case-sensitive searches in existing database records.

I'd suggest to give it v2.0 to communicate better that this version has a breaking change.

Unicode sorting

In the Dutch translation, Ålandeilanden is sorted last. I would expect the Å to be sorted as a normal A (although unicode sorting is more complicated than that, it certainly shouldn't expect it to be last).

A possible solution from stackoverflow:

To properly collate strings according to locale, the ffi-icu gem could be used:

require "ffi-icu"

ICU::Collation.collate("it_IT", %w[à a e])
# => ["a", "à", "e"]

ICU::Collation.collate("de", %w[a s x ß])
# => ["a", "s", "ß", "x"]

Release new version

While master already uses the new ISO codes, the current 1.1.3 does not. Gave me some headache until I figured it out. Would love to see a release of the current state.

Global configuration to always use ISO codes raises error

Rails 4.0.1, country_select 1.2.0, ruby 2.1.0-preview

I added the following configuration to an initializer according to Readme:

::CountrySelect.use_iso_codes = true

An exception is raised on app start:
/app/config/initializers/country_select.rb:1:in <top (required)>': undefined methoduse_iso_codes=' for CountrySelect:Module (NoMethodError)

CountrySelect 1.2 breaks countries support

Hey guys, I believe integration with the countries gem has broken with 1.2 as you're now defining COUNTRIES in CountrySelect::COUNTRIES and checking whether the constant exists in CountrySelect or in the global namespace.

Before you were defining it in ActionView::Helpers::FormOptionsHelper::COUNTRIES which is where countries is currently defining it.

In the meantime I downgraded to 1.1.3 and it's working fine.

Not sure whether this issue belongs here or in countries.

/ccing @hexorx

Order of priority_countries

It'd be cool if the order of priority_countries option would be preserved. For example:

country_select :user, :country, priority_countries: ["CH","DE"] would output Switzerland first and Germany second while passing priority_countries: ["DE","CH"] would render Germany first.

Cannot get priority countries to work

Please I've tried everythign in the book, why can I not get this to work??

<%= country_select :class_registration, :country, ["United States"], :prompt => true %>
<%= f.country_select :country, ["United States"], :prompt => true %>

It does not put US at the top of the list!

Is the :only option working on Rails 4.1?

Hi, I can't get the :only option working.

<%= country_select("address", "country", only: ["GB", "FR", "DE"]) %>

Includes all the countries for the select...

I'm on Rails 4.1.8, Ruby 2.1.5
Using the latest release of the gem, 2.1.0

Unreleased version 2.0?

I was following the documentation for version 2.0, but after some debugging I noticed the latest released version is 1.3.1. Am I missing something?

New arguments makes it hard for Formtastic

Hey folks, Formtastic currently supports any country select plugin that has the same API/arguments as was originally supported by Rails when the country select helpers were extracted out to a plugin.

The reason we're agnostic about the choice of country select plugin is because some choose to deviate from the ISO standard.

Now that the unreleased 2.0 version has changed the arg structure, it's going to be tricky for us to continue supporting both your new structure and your previous one (let alone any other plugins supporting the old or new structure).

My first inclination was to check CountrySelect::VERSION, but that ties us to your plugin too much. Next, I tried checking the method arty, but it looks like it's -2 in both cases.

I'm pretty supportive of your new structure, but I'm not sure how to proceed, other than ignoring your new syntax, adding some kind of configuration on our side, or dropping support for this stuff altogether over time. None of these are great experiences for Formtastic users.

I was hoping that maybe there'd be a special class that's unique to your plugin, or some other method we could check as some kind of feature detection, but I can't see anything in the code base.

I don't expect there's much you folks can do or would be motivated to do to help this situation, but here's a list of far-fetched possibilities for your consideration:

  • support both the old and new syntax in the existing method (haven't checked feasibility of this, but it's either an Array or Hash, so seems plausible)
  • support both the new and old syntax by exposing the old one as a new method (e.g. legacy_country_select(), which we can use for detection
  • provide access to some kind of new boolean method that we can use for feature detection across plugins (e.g. priority_countries_in_options?)
  • provide access to some kind of method or class that only exists in your plugin and only in 2.0 that we can use add-in an edge case for this plugin specifically (since all others than I know of use the previous arg structure)

This is a problem pretty unique to Formtastic and other form builder wrappers, so I'd be happy to work up a patch for any of these options if it's likely to be accepted.

See formtastic/formtastic#1008 for a bit more detail and a link to a branch I've started to explore supporting this new syntax.

No required="required" attribute when the field is mandatory with simple_form

This is a small issue (and I'll try to fix it and submit a patch when I have some time) but the select input doesn't get the required="required" attribute that triggers html5 validations even though the field is mandatory.

Everything else ("required" class, " * ") seems to be in order, and of course adding input_html: { required: 'required' } to the input method call does the trick, but it would be nicer to have everything work accordingly.

Undefined Method

I've got a weird error that cropped up yesterday with the country_select gem...

I've got an organization model in my app--when you create a new org, you'll need to enter in its address, including the country. I chose to present the country options using the country_select gem.

When you try to load the new organization page, it says something went wrong-- the logs say:

ActionView::Template::Error (undefined method `first' for nil:NilClass): 
   </div> 
   <div class="field"> 
     <%= f.label :country %> <span class="required">*</span><br> 
     <%= f.country_select :country, [ "United States", "Canada", "United Kingdom", "Mexico", "Australia", "South Korea" ] %> 
   </div> 
   <div class="field"> 
     <%= f.label :zip_code, "Zip Code/Post Code" %> <span class="required">*</span><br>

Replacing the country select drop down with a text input field solved it--so, I knew it had to be related to this gem. I noticed I was using version 2.0.0 in production, so I reverted to 1.3.1 and that seems to have fixed the problem.

only options

I was previously able to use country_options_for_select to render only the options for a select. This seems to have been removed? Has this been replace with another method?

Localizing country names in helper

Hi!

I think this is a common need for many people and a major lack of the gem, which is great whatsoever.

I hacked the gem to get this functionality in the past: https://github.com/dgilperez/country_select/commits/master but it seems hacky and it's outdated.

I also saw @chrkau try another hack recently: chrkau@c56d351#commitcomment-3776245

My question: what would you choose as the best approach for this? I can get a couple of hours next week to work on it.

Regards!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.