Last time I got the problem with active_admin . In tables where I have 5000+ rows of data it's work very slowly. How I can optimize it? Maybe somebody know some async load plugins for this module?
There are a couple things you can do.
By default, Active Admin loads associations as drop-down filters on the index page. If those filters aren't being used, it helps to remove them because they instantiate every record of that model to build the drop-down.
ActiveAdmin.register Post do
remove_filter :categories
end
If your index page has columns that depend on associated records, it helps to eager-load them.
ActiveAdmin.register Post do
controller do
def scoped_collection
super.includes :author, :publisher
end
end
end
This doesn't really apply since you only have 5000 records, but if you get to the point where even a DB COUNT
of the table takes a long time, you might want to disable the count in the bottom right of the index page. (this feature was added in 0.6.1)
ActiveAdmin.register Post do
index pagination_total: false
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.