6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/active_admin/async_exporter/reports/worker.rb', line 6
def perform(options = {})
controller = options[:controller].classify.constantize.new
columns = options[:columns]
file_name = filename(options[:file_name], controller)
path = Rails.root.join('tmp', file_name)
CSV.open(path, 'wb', headers: true) do |csv|
build_csv(csv, columns, controller, options)
end
file = Services::StorageService.call(path: path, name: file_name).store
AdminReport.find(options[:admin_report_id]).update_attributes!(
status: :ready,
location_url: file.url
)
end
|