A Ruby on Rails app that generates a random location and suggests a vacation to the user. Perfect for the travel-addict in your life!
Navigate to the front page, click “Where to?” and get a random location somewhere in the world.
The application has a database of over 2800 cities from all around the world. When you navigate to the homepage, the application selects a random city from the database, and it shows you basic information about that city. When the page loads, it also goes out to Flickr to look for some photos that are tagged with that city and country. (If Flickr doesn’t have any photos for that location or if Flickr is down, you get pandas and penguins.) The application also gets some information from Wikipedia about the location it pulls. If there’s an error with the Wikipedia query, you see a quote about travel. The UI is built on Bootstrap, and it uses custom error pages if you run into something you shouldn’t see on the site.
-
Database of cities from around the world
-
UI shows a random city pulled from the database
-
When the user clicks “show me more,” an extra partial shows to give some more information about the place generated (currently only contains dummy info)
-
Use the Flickr API to pull photos for the location generated by the db (mostly complete; just finishing up some error handling)
-
Make custom error pages
-
Set up a second db to keep track of language, region, and currency for each country
-
Use the Wikipedia API to pull some information about the location generaed by the db
-
Refactor, refactor, refactor! I know this code can be improved; I have a much better idea of what I’m doing now (in 2019) than I did in 2017 when I began building this project.
-
Write more tests
-
Make the UI a little prettier
-
Migrate to Rails 6
Credit for the database of locations used: simplemaps.com/data/world-cities
Credit for the country data csv file: raw.githubusercontent.com/datasets/country-codes/master/data/country-codes.csv
Credit for explanation of how to import a database to a Rails app db: gorails.com/episodes/intro-to-importing-from-csv
Credit for explaining how to show a partial only when a button is clicked: blog.codeship.com/unobtrusive-javascript-via-ajax-rails/
Credit for explaining how to set up basic custom error pages: mattbrictson.com/dynamic-rails-error-pages