Active Admin in rails - csv limit

╄→гoц情女王★ 提交于 2019-12-22 06:54:10

问题


I was downloading a csv of a model using active admin 0.3.4 that had around 12,000 records. But the csv was limited to only 10,000 rows of data. Is there a way to not limit the number of rows in the csv download?


回答1:


There was a function called max_csv_records in lib/active_admin/resource_controller/collection.rb of the github source code.. Change the default constant to how much ever you need




回答2:


It's hardcoded

I put this in my config/intializers/active_admin.rb

# Monkey patch to increase the number of records
# exported in csv download -default is 10k
module ActiveAdmin
  class ResourceController
    module DataAccess
      # in active admin 0.6
      def max_csv_records
        30_000
      end
      # needed for current active admin master
      def max_per_page
        30_000
      end
    end
  end
end 


来源:https://stackoverflow.com/questions/9355126/active-admin-in-rails-csv-limit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!