Shyam Kirubha
Shyam Kirubha

Reputation: 33

State and Country select show most used with city-state gem

I use city-state gem to populate Country and State dropdown, in order to save address information. I would like to know if there a way to push "the most used/selected" states to the top of the list.

I would want to show them first by "the most selected states", and then by all states in alphabetical order?

Upvotes: 1

Views: 1103

Answers (1)

Nezir
Nezir

Reputation: 6925

No, gem currently does not have that kind of filtering. There is only an info about showing last country:

When getting a city list, you can also specifies the country:

CS.cities(:sp, :br)

The country is an optional argument. city-state always uses the last country that you used.

https://github.com/loureirorg/city-state

Of course you can upgrade the gem by adding field for counting most used countries/cities ...

Upvotes: 1

Related Questions