Skip to content

Allow customisation of header names when rendering a collection #1

@michiels

Description

@michiels

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions