Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all country codes have a similar type #40

Open
RaphSfeir opened this issue Sep 16, 2019 · 0 comments
Open

Ensure all country codes have a similar type #40

RaphSfeir opened this issue Sep 16, 2019 · 0 comments

Comments

@RaphSfeir
Copy link

I am using the countries list to get a country name using it's ISO3166 code.

This is done easily using the :number attribute of a country.

Example: Countries.filter_by(:number, "250")

This works great in most cases, given that the code is a string. However, sometimes the :number attribute is stored as an integer, for example country with ISO code 48 (Bahrain) or Bolivia. For those countries I need tu use this: Countries.filter_by(:number, 48)

Obviously, this isn't a major issue as I'm just bypassing this by using a map function on all countries to convert to either string or an integer. Just converting all codes solves this problem.

But I thought I'd share this issue as it would make the list cleaner and debugging less confusing when using country ISO3166 codes to just use the same type for all countries, whether string or int.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant