app/models/effective/effective_datatable/csv.rb in effective_datatables-4.14.2 vs app/models/effective/effective_datatable/csv.rb in effective_datatables-4.15.0

- old
+ new

@@ -13,10 +13,20 @@ def csv_content_type 'text/csv; charset=utf-8' end def csv_header - columns.map { |_, opts| opts[:label] || '' } + columns.map do |name, opts| + opts[:label].presence || csv_human_attribute_name(name) + end + end + + def csv_human_attribute_name(name) + if active_record_collection? + collection_class.human_attribute_name(name) + else + (name.to_s.split('.').last || '') + end end def csv_file CSV.generate do |csv| csv << csv_header()