I have a user model with name and id.
I want to store the of all the columns in users to a csv file.
How do I use CSV.generate function to do that?
I have a user model with name and id.
I want to store the of all the columns in users to a csv file.
How do I use CSV.generate function to do that?
The following code will write the attributes of all users to a file:
Source: How to convert array of ActiveRecord models to CSV? (duplicate question)