-
Notifications
You must be signed in to change notification settings - Fork 135
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
Adding a missing city is not working properly #67
Comments
duduribeiro
added a commit
to duduribeiro/city-state
that referenced
this issue
Nov 24, 2023
Closes thecodecrate#67 There is a problem with city_lookup. It only loads the cities for the first statue you called `cities` on. This is because `cities` memoizes all the cities for the country, but `city_lookup` only loads the cities for the state, and doesn't get called again for the other states. Ex: having the following `db/cities-lookup.yml`: ```yaml BR: GO: "Mutunópolis": "Mutunópolis" ``` If I load first cities for other state, it does not include this missing city: ```shell bin/rails c CS.cities(:sp, :br) # loading another state first CS.cities(:go, :br).include?("Mutunópolis") ``` returned false but it should be true. If I load this state first, it works correctly ```shell bin/rails c CS.cities(:go, :br).include?("Mutunópolis") ``` This commit changes `city_lookup` to load all the cities for the country.
This was referenced Nov 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having an issue while adding a missing city.
The first one is that is raising an error but I opened a PR for that: #66
The second one is that when I add a missing city, if I try to find cities for a state other the one that I added, it does not load the city. It only loads the new city if I call
.cities
first for the state that I'm adding the missing record.Example:
db/cities-lookup.yml
If I load first cities for other state, it does not include this missing city:
returned false but it should be true.
If I load this state first, it works correctly
do u folks have any idea why this is happening? Thanks
The text was updated successfully, but these errors were encountered: