Heroku Rails Console Write to Local File
Heroku supports ftp in passive mode. So create the file on the server and download the file to local machine with ftp.
# FTPing from Herokuftp = Net::FTP.new(server, user, pass)ftp.passive = trueftp.getbinaryfile(remote_filename, tmp_filename)
References:
Perversely, I found the easiest thing to do was just to email the content to myself.
I don't know that it's advisable, but you can actually start a rails console instance locally while connecting to the remote database on Heroku. Get the database connection information from the Heroku dashboard and add it to your local database.yml file in place of your regular development stanza. Something like
development: adapter: postgresql encoding: unicode database: agblah9dff3 host: ec2-44-333-444-100.compute-1.amazonaws.com pool: 5 username: 8fk38hg72hd98d port: 5462 password: 88dk3jblahblah8sk83df8sdfj23 timeout: 5000
But know that you're playing with production code, so...you know, it's pretty risky.
A better idea might be to just use a database IDE that creates exports for you, or write a rake task that collects the info in a file and dumps it on S3. You won't be able to write files to disk Heroku.