countries / country_select

Gemification of rails's country_select
https://country-select-demo.onrender.com
MIT License
704 stars 198 forks source link

Duplicate countries for Zulu #216

Closed adrianmann closed 1 year ago

adrianmann commented 1 year ago

It appears that using the Zulu country code zu is returning duplicate countries. I am unsure whether this is an issue in our setup or if this is the expected list for the zu code. Can anyone confirm or point me in the right direction?

Screenshot from 2023-01-17 23-06-29

This is an example of our select box:

<div>
   <%= country_select "country_code", :country_code, {selected: @user.country_code, only: Rails.application.config.country_codes} %>
</div>
pmor commented 1 year ago

(Issue transferred over to country_select repo.)

@adrianmann From the code example, I suspect you might have duplicate country codes in Rails.application.config.country_codes, since the array provided to only: will override the list of countries.

Looking at that screenshot, you might be using an older version of countries and/or country_select gems, as some of those names don't match the latest versions of the gems, and there could be issues with the translations in older versions.

adrianmann commented 1 year ago

@pmor Thanks for the reply.

This is the output of Rails.application.config.country_codes

["AE", "AF", "AL", "AM", "AO", "AR", "AT", "AU", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BW", "BY", "CA", "CD", "CF", "CG", "CH", "CI", "CL", "CM", "CN", "CO", "CR", "CU", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ER", "ES", "ET", "FI", "FJ", "GA", "GB", "GE", "GH", "GI", "GL", "GM", "GN", "GR", "GT", "GU", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KA", "KE", "KG", "KH", "KP", "KR", "KW", "KZ", "LA", "LB", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MI", "MK", "ML", "MM", "MN", "MT", "MU", "MW", "MX", "MY", "MZ", "NA", "NE", "NG", "NI", "NL", "NO", "NP", "NZ", "OM", "PA", "PE", "PG", "PH", "PK", "PL", "PR", "PT", "PY", "QA", "RO", "RS", "RU", "RW", "SA", "SD", "SE", "SG", "SI", "SK", "SL", "SM", "SN", "SO", "SS", "SV", "SY", "SZ", "TD", "TG", "TH", "TJ", "TM", "TN", "TO", "TR", "TT", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VE", "VN", "WS", "YE", "ZA", "ZM", "ZW"]

I will try updating the gem version.

adrianmann commented 1 year ago

Updating the gem fixes the issue. Thanks @pmor