Summary
The current documentation does not explain how to generate CSV exports when:
Columns are determined dynamically at runtime
Existing column headers need to be renamed dynamically
Dynamic extractors are required to support dynamic fields
These use cases are common when exporting user-defined attributes or dynami fields.
Problem
For example, consider a User model that belongs to a DynamicField, where each dynamic_field defines its own set of dynamic attributes.
When exporting users, the CSV structure cannot be fully defined in a static comma block because:
The set of columns depends on the platform configuration
Header names may change dynamically
Values are stored in associated records rather than direct model attributes
The existing documentation covers static columns well, but it is unclear how to:
Generate headers dynamically
Rename existing columns at runtime
Access runtime context within extractors
Extend Comma::HeadersExtractor or Comma::DataExtractor
Suggested documentation additions
Consider adding a guide or examples for:
Dynamic column generation based on runtime data
Renaming column headers dynamically
Using static_column in advanced scenarios
Exporting associated dynamic attributes
Complete examples for common use cases such as user-defined fields
Example use case
class User < ApplicationRecord
belongs_to :dynamic_field
has_many :dynamic_values
end
Each dynamic_field defines a variable set of dynamic values, and the export should include one CSV column per attribute.
Because the available columns vary by dynamic_field, users currently need to inspect Comma internals without guidance.
Additional examples in the documentation would make these advanced use cases much easier to discover and implement.
Summary
The current documentation does not explain how to generate CSV exports when:
Columns are determined dynamically at runtime
Existing column headers need to be renamed dynamically
Dynamic extractors are required to support dynamic fields
These use cases are common when exporting user-defined attributes or dynami fields.
Problem
For example, consider a User model that belongs to a DynamicField, where each dynamic_field defines its own set of dynamic attributes.
When exporting users, the CSV structure cannot be fully defined in a static comma block because:
The set of columns depends on the platform configuration
Header names may change dynamically
Values are stored in associated records rather than direct model attributes
The existing documentation covers static columns well, but it is unclear how to:
Generate headers dynamically
Rename existing columns at runtime
Access runtime context within extractors
Extend Comma::HeadersExtractor or Comma::DataExtractor
Suggested documentation additions
Consider adding a guide or examples for:
Dynamic column generation based on runtime data
Renaming column headers dynamically
Using static_column in advanced scenarios
Exporting associated dynamic attributes
Complete examples for common use cases such as user-defined fields
Example use case
class User < ApplicationRecord
belongs_to :dynamic_field
has_many :dynamic_values
end
Each dynamic_field defines a variable set of dynamic values, and the export should include one CSV column per attribute.
Because the available columns vary by dynamic_field, users currently need to inspect Comma internals without guidance.
Additional examples in the documentation would make these advanced use cases much easier to discover and implement.