Вы можете написать свой собственный код генерации CSV.Вот некоторый код для начала работы:
sidebar :download_as_csv, :only => [:index] do
a(href: download_as_csv_admin_papplications_path(params.slice(:scope, :filter))) do
'Download as csv'
end
end
collection_action :download_as_csv, :method => :get do
# define your own headers
csv_headers = ["Question 1", "Answer 1", "Question 2", "Answer 2"] # customize yourself
rawcsv = CSV.generate(:col_sep => ",") do |csv|
# here you could add headers
# csv << csv_headers
# scoped_collection is provided by activeadmin and takes into account the filtering and scoping of the current collection
scoped_collection.each do |papplication|
csv_row = []
# Create a convenience method in the Papplication model that returns a hash of question_text to answer_text
papplication.questions2answers_hash.each do |question, answer|
csv_row << question
csv_row << answer
end
csv << csv_row
end
end
send_data(rawcsv, :type => 'text/csv charset=utf-8; header=present', :filename => Time.now.strftime("%Y%m%e-%H%M%S")) and return
end
Удачи!