Skip to content

Use << to add missing city to the list#66

Open
duduribeiro wants to merge 1 commit intothecodecrate:mainfrom
duduribeiro:fix-adding-missing-city
Open

Use << to add missing city to the list#66
duduribeiro wants to merge 1 commit intothecodecrate:mainfrom
duduribeiro:fix-adding-missing-city

Conversation

@duduribeiro
Copy link

Hey folks 👋

I'm using ruby 3.2.2 and having a issue when adding a missing city. I added this yml to my project:
db/cities-lookup.yml

BR:
  GO:
    "Mutunópolis": "Mutunópolis"

but when I run

CS.cities(:go, :br)

to test it fails for me because:

/Users/cadu/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/city-state-1.1.0/lib/city-state.rb:185:in `[]=': wrong number of arguments (given 1, expected 2..3) (ArgumentError)

              @cities[country][state][] = new_value

I think the idea of this line is to add a new_value to the existing array, so I changed it to include the new line

Instead of using `@cities[country][state] = new_value`, use `<<` to add the missing city into the cities list
@duduribeiro
Copy link
Author

duduribeiro commented Feb 22, 2024

hey @loureirorg 👋

Just pinging to check if this one and #68 are valids. Just wanted a bump of version so I can use this instead of a fork 😄

Thanks!

@diogolsq
Copy link

@loureirorg Any news on this one?

We are also running a local fork just to circumvent this issue.

@anko20094
Copy link

We still waiting :)

duduribeiro added a commit to duduribeiro/civitas that referenced this pull request Feb 19, 2025
City-state has two problemas that is prohibiting using the gem on most
recente ruby versions:
- thecodecrate#68
- thecodecrate#66

This commit applies these fixes
@duduribeiro
Copy link
Author

We still waiting :)

Hey @anko20094 👋

I tried to reach @loureirorg about these but without success. I created a new gem https://github.com/duduribeiro/civitas https://rubygems.org/gems/civitas which contains these fixes and I will try to apply future fixes as well, since I use these gem. It is an easy drop-in replacement for city-state (just replace city-state to civitas in Gemfile). I know this is not the best scenario but it is how I followed to.

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

Successfully merging this pull request may close these issues.

3 participants