You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose adding a column_names method to ActiveHash, similar to the method available in ActiveRecord. The primary motivation for this addition is to facilitate the generation of CSV headers when exporting data from models that utilize ActiveHash::Base.
In ActiveRecord, the column_names method returns an array of column names as strings. The implementation is straightforward:
# Returns an array of column names as strings.defcolumn_names@column_names ||= columns.map(&:name).freezeend
motivation
For ActiveHash, having a column_names method would be beneficial in scenarios where we need to export data to CSV, ensuring the headers are generated dynamically based on the model's columns.
Use Case:
Exporting data from ActiveHash::Base models to CSV.
Dynamically generating CSV headers based on the model's columns.
The text was updated successfully, but these errors were encountered:
Description
I would like to propose adding a column_names method to ActiveHash, similar to the method available in ActiveRecord. The primary motivation for this addition is to facilitate the generation of CSV headers when exporting data from models that utilize ActiveHash::Base.
In ActiveRecord, the column_names method returns an array of column names as strings. The implementation is straightforward:
motivation
For ActiveHash, having a column_names method would be beneficial in scenarios where we need to export data to CSV, ensuring the headers are generated dynamically based on the model's columns.
Use Case:
Exporting data from ActiveHash::Base models to CSV.
Dynamically generating CSV headers based on the model's columns.
The text was updated successfully, but these errors were encountered: