New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customisation of header names when rendering a collection #1

Open
michiels opened this Issue May 12, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@michiels
Member

michiels commented May 12, 2018

The CsvExport#render_collection(a_collection) method currently uses the fields passed into CsvExport.new to read column values from the objects in a_collection. This makes it really easy to provide clear-cut CSV exports.

However, sometimes we want to name columns just a little bit different than their underlying field name or virtual attribute.

For example, we could update the #new method to support the following:

export = CsvExport.new(id: :number, name: :full_name)
export.render_collection(@customers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment