Skip to content

Instantly share code, notes, and snippets.

@adeelejaz
Last active August 29, 2015 14:06
Embed
What would you like to do?
How to download a bunch of files in Rails and save them?
require 'open-uri'
arr = ['http://example.com/file1.txt', 'http://example.com/file2.txt']
arr.each do |url|
open(url.split('/').last, 'wb') do |file|
file << open(url).read
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment