thecodecrate / city-state

Simple ruby gem to create form lists with cities and states
MIT License
306 stars 135 forks source link

Adding a missing city is not working properly #67

Open duduribeiro opened 9 months ago

duduribeiro commented 9 months ago

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: https://github.com/thecodecrate/city-state/pull/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:

If I load first cities for other state, it does not include this missing city:

bin/rails c
CS.cities(:sp, :br) # loading another state first
CS.cities(:go, :br).include?("Mutunópolis")

#> false

returned false but it should be true.

If I load this state first, it works correctly

bin/rails c
CS.cities(:go, :br).include?("Mutunópolis")

#> true

do u folks have any idea why this is happening? Thanks