Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Beynon eToThePiIPower

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am etothepiipower on github.
@eToThePiIPower
eToThePiIPower / seeds.rb
Created Jul 8, 2013
A simple seeds.rb to seed a rails app with data from Yahoo Local. Uses Yahoo's public API so no API key is required.
View seeds.rb
#/db/seeds.rb
require 'open-uri' # Needed to open web urls
Restaurant.delete_all
zip = "10006" # Set a search zip
returns_per_term = 5 # How many restaurants to return per query
owner = Owner.first # Need an owner
terms = ["burgers", "italian", "deli", "coffee", "cuban", "japanese", "steakhouse"] # Terms to search for, should all names of categories
terms.each do |term|
# Query the Yahoo Local API