Skip to content

Instantly share code, notes, and snippets.

@orendon
Last active December 1, 2015 21:58
Show Gist options
  • Save orendon/002fea2bf9e43358e63d to your computer and use it in GitHub Desktop.
Save orendon/002fea2bf9e43358e63d to your computer and use it in GitHub Desktop.
Create text file example
# Create basic text file
# http://ruby-doc.org/core-2.2.0/File.html
datos = [1, 2, 3, 4, 5, 7, 8]
File.open("path/to/ejemplo.txt", "w") do |f|
datos.each do |dato|
f.puts "Dato #{dato}"
end
end
# then on http response
# http://apidock.com/rails/ActionController/Streaming/send_file
send_file 'path/to/ejemplo.txt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment