Skip to content

Instantly share code, notes, and snippets.

@sumitngupta
Created January 20, 2014 19:55
Show Gist options
  • Save sumitngupta/8527817 to your computer and use it in GitHub Desktop.
Save sumitngupta/8527817 to your computer and use it in GitHub Desktop.
namespace :quotes do
desc 'Import data from the Ted API'
task :import_data => :environment do
# here is where you put the code to hit your Quote model.
still_has_data = true
page = 0
while still_has_data do
Quote.save_data_from_api(do something with the page variable to move the offset here)
# if your response has no more results, set still_has_data to false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment