Reputation: 2385
I have more than 50K records in database but when I download a csv from active admin it gives me just 10K. I have googled the solutions and got that there is limit in the method named max_csv_records in
lib/active_admin/resource_controller/collection.rb
is there some way from which I can override this and increase the limit ?
Here's the gist I got https://gist.github.com/3177995 but can you guys tell me how can I use this code ? It would be much better if I can add something in active admin initializer
Upvotes: 2
Views: 1538
Reputation: 399
Just for future googlers. My fix (working for the current Master 1.0.0pre) is to add the following to config/initializers/active_admin.rb
:
module ActiveAdmin
class ResourceController
module DataAccess
# needed for current active admin master
def max_per_page
30_000
end
def per_page
return 30_000 if %w(text/csv application/xml application/json).include?(request.format)
return max_per_page if active_admin_config.paginate == false
@per_page || active_admin_config.per_page
end
end
end
end
Replace the max as needed. This works for csv, xml and json downloads.
Upvotes: 2
Reputation: 11167
here is monkey patch for increasing export record limit https://github.com/gregbell/active_admin/issues/346
Upvotes: 0