Last active
January 23, 2019 07:27
-
-
Save manojmj92/832fc6321b52becca1277c5a727a9891 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment