Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_csv(column_names, records)
- CSV.generate do |csv|
- csv << column_names # add headers to the CSV
- records.each do |record|
- csv << record.attributes.values_at(*column_names)
- end
- end
- end
Add Comment
Please, Sign In to add comment