Last active
December 1, 2015 21:58
-
-
Save orendon/002fea2bf9e43358e63d to your computer and use it in GitHub Desktop.
Create text file example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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