Skip to content

Instantly share code, notes, and snippets.

@FestivalBobcats
Created September 24, 2013 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FestivalBobcats/6689477 to your computer and use it in GitHub Desktop.
Save FestivalBobcats/6689477 to your computer and use it in GitHub Desktop.
importing stuff into qbox with tire
Tire.configure do
url QBOX_ENDPOINT
end
Tire.index(INDEX_NAME) do
delete_if_exists
create
end
json_filepaths.each do |filepath|
json = File.read(filepath)
emails = JSON.parse(json)
emails.map! do |email_hash|
email_hash.merge(type: 'email')
end
Tire.index(INDEX_NAME) do
import emails
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment