Have you ever needed to gather a large amount of data from your production server but didn't have the script available on the server? You could remote into the server and write the script in rails console but what if the volume of data was in the hundreds of thousands? And you needed it in CSV format? Well, recently I recently discovered a great little command for gathering remote data and saving it to a local file.
If you are exporting to a CSV you'll need to make sure that the script uses
puts before the generated data. This will properly print out the CSV string and save it to the data.txt file listed in the above snippet.
In one of my previous posts, Exporting to a CSV, I mentioned how to go about exporting data into CSV format. Building upon that lesson let's see what the the new command would look like.