I want to pull some information from my database into a text file.
What's a good way to do that? I originally thought of running my heroku bash and rails console as I only need to do a simple loop to get the info I need. But I don't know the proper way to write to a file from heroku. It works in my local rails console
I've tried
File.open('text.txt', 'w') do |f|
User.all.each do |u|
f.puts u.email
end
end
or something like $stdout = File.new('/path/to/text.txt', 'w')
but I think these files don't end up in my local directory...
How do I do this?
Alternate simple solutions also welcome since I didn't think I was doing anything overly complex
Attempting Pakrash's answer
In heroku bash + rails c
I put in
require 'net/ftp'
ftp = Net::FTP.new('address.herokuapp.com','email@example.com', 'somepassword')
This just hangs though. No error.. I have to crl +c out of it
I previously had my full address https://adddress.herokuapp.com/ in there but it was saying getaddrinfo: Name or service not known
Should I be entering this in differently?