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

Proper way to only change a few subset of data #486

Closed
smennesson opened this issue Nov 13, 2017 · 1 comment
Closed

Proper way to only change a few subset of data #486

smennesson opened this issue Nov 13, 2017 · 1 comment

Comments

@smennesson
Copy link

Hello and first thank you for this awesome gem.

I'm trying to only change the name of a country without losing its other data.

I think I've found the proper way like this:
ISO3166::Data.register(ISO3166::Country.new('KP').tap { |c| c.data[:name] = 'North Korea' }.data.symbolize_keys)

It seems to work, I think the only change is the pre-loading of all translations like warned in the Readme ("Loading Custom Data" section).

So here this is not really an issue I'm opening, I'm just asking if this is the proper/best way do to this? If so, maybe it could be described in the "Loading Custom Data" section of the Readme, as it took me a moment to find this solution.

If you find useful to include this in the readme, just pay attention that symbolize_keys is a Rails method.

Kind regards

@rposborne
Copy link
Collaborator

I think this is a completely valid solution. We do not have an API to just merge the data together currently, but I would be more than happy to accept a PR on one.

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

2 participants