I'm using ActiveAdmin ( https://github.com/gregbell/active_admin ) for Rails, and am trying to load the index view of my User model. Here's the code in my app/admin/users.rb file:
ActiveAdmin.register User do
config.per_page = 10
index :pagination_total => false do
end
end
I have pagination enabled, but it looks like it's still trying to load all of the users, resulting in a timeout. How do I get it to load only a few (eg 10) users at a time?
A few things you could try to improve performance on your pages:
Try disabling the count from any scopes you might have:
scope :active, show_count: false
Try disabling filters you don't need
config.filters = false #or simply specify the ones you do need
Avoid n+1 queries by eager loading any associated models
controller do def scoped_collection resource_class.includes(:brownies) end end
Hope this helps.
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.