Closed yuryroot closed 7 years ago
Hi, I think this is a nice idea but have some questions/comments:
to_h
and to_a
for say a country select field will now have what can be considered invalid countries.@sshaw, there are my answers on your questions/comments:
There are different types of country codes in my private project.
For example: US
, BR
, RU
, ... and WO
, EO
, ...
In this example US
, BR
, RU
are valid country codes, and WO
, EO
are patent offices.
I think that in this case we shouldn't mix different types of countries in the default list.
I think so, because it will solve only my problem and my custom data are not needed for other people by default (in particular in methods to_a
and to_h
, as you said in the second comment).
We need a more universal solution.
to_a
and to_h
.
It is expected behaviour for user who extends the default list...There are different types of country codes in my private project. For example... ... US, BR, RU are valid country codes, and WO, EO are patent offices.
Got it. Makes sense.
Do you mean that we can append a separate YAML config for deprecated countries or append mapping to the existing config?
I was thinking that all deprecated codes should be added to en.yml
with a deprecated
key or to a separate en.yml
file. Then a method could be added say, NormalizeCountry.use_depricated!
, that would add them to this list. Though I think this is out of scope for this pull request 😄
Thanks for your review. I will do corrections ASAP.
Hello, @sshaw! I'm sorry for so long absence...
I consider your comments and changed code.
I also found and fixed a problem when method extend_countries
incorrectly processes already existing countries. The method merges such countries now.
Commit: 7fdf933bcd6494391fa9ad0c3b831b07f1d86a23.
Could you please see latest changes?
Hi @yuryroot, thanks for the changes. Give me a day or so to have a look. 👓
Closing due to no response. Fell free to open again if you'd like to complete.
Hello, @sshaw!
First, thank you for fast and simple gem! Second, I want to propose my implementation of feature to extend a default countries list by user data. I think that such function will be useful.
What do you think about it?