Question: Instruction You will create an application that consumes the World Population API and allows individuals to view a list of countries. The Show method of

Instruction

You will create an application that consumes the World Population API and allows individuals to view a list of countries. The Show method of each Country should display the age distribution of the population of the selected country for the current year.

I have created a new Rails application called worldpopulation. This application will have one (and only one!) model: Country. Scaffold it according to the following diagram:

Question

In the index method for Country, check to see if there are any Country objects currently stored in the database. IF NOT, query the API and create a new Country object for each country returned from the service. (HINT: write a CLASS METHOD in the Country model that contains the code to execute the query and update the database.)

Link to World Population API http://api.population.io/#!/countries/listCountries

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!