<%- csv_lib = if RUBY_VERSION =~ /^1.8/ require 'fastercsv' FasterCSV else require 'csv' CSV end default = active_admin_application.csv_options options = default.merge active_admin_config.csv_builder.options columns = active_admin_config.csv_builder.columns csv_output = csv_lib.generate(options) do |csv| csv << columns.map(&:name) collection.each do |resource| csv << columns.map do |column| call_method_or_proc_on resource, column.data end end end %> <%= csv_output.html_safe %>