【发布时间】:2013-12-28 15:45:13
【问题描述】:
我的应用程序中 Article 模型的 Active Admin 索引页面需要很长时间才能加载。这是因为有超过 2500 个文章条目,并且因为我启用了过滤器(并且我需要启用过滤器)。我觉得我已经在做文档推荐的所有事情,当谈到加快速度时,但不知何故,它仍然在拉起每篇文章(当我只希望它拉起特定页面上的文章时)。也就是说,分页似乎无法正常工作。
以下是代码示例:
ActiveAdmin.register Article do
filter :title
config.sort_order = "published_desc"
config.per_page = 10
index :pagination_total => false do |article|
# code for my columns goes here
end
end
以下是日志中的一些相关输出。有很多很多这样的调用,即使我只是尝试按标题搜索一篇文章(例如使用过滤器):
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (258.8489ms)
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (234.8890ms)
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (269.1431ms)
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (240.3183ms)
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (250.5591ms)
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (403.0311ms)
MOPED: 127.0.0.1:27017 GET_MORE database=[db_name] collection=articles limit=0 cursor_id=1211541689548427701 (250.7601ms)
【问题讨论】:
标签: ruby-on-rails filter pagination activeadmin