I've looked into storing locations with Ruby today. Haven't found what one could call best practices, but discovered a lot of interesting gems.
The initial idea was to save the address, zip code and country code. This way we could find out about the location and region with a reverse lookup. Preferably without hitting an external service.
Here we go:
Not sure what it includes, but certainly not data from Switzerland
This one looked promising, unfortunately US only as well
US only –.–
Getting closer. Ruby gem for a pretty cool service called GeoNames that let's you lookup all kind of location related data.
This one almost did it for me. Unfortunately the Swiss regions are a mix of french and german. Could do a PR but I feel like this needs to be correct from the start.
Another interesting one. But also weird localizations for Swiss regions...
Not what I intended in the beginning. But the best I've found so far.
And last but not least geocoder. Also hits external services for looking up information.
The ones that do not hit external services unfortunately had wrong localizations. I could create a PR for fixing the ones from Switzerland. The problem is I also need location data from other countries and I don't know if the provided information is correct or not. That's why I'm going with geokit/geokit or alexreisner/geocoder. Both seem well maintained and popular.