I want to extract some information from my database into a text file.
What a good way to do this? Initially, I was thinking of starting mykkku bash and rails console, since I just need to do a simple loop to get the information I need. But I do not know how to write a file from a hero. It works in my local rails console
I 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 do not fall into my local directory ...
How to do it?
Alternative simple solutions are also welcome, as I did not think that I was doing something too complicated
Trying to answer Pakrash
In heroku bash + rails c
I put
require 'net/ftp' ftp = Net::FTP.new('address.herokuapp.com',' email@example.com ', 'somepassword')
It just freezes. There is no mistake. I need crl + c from her
I previously had my full address https://adddress.herokuapp.com/ , but he said getaddrinfo: Name or service not known
Should I introduce this differently?
source share