【问题标题】:How to cache index page with pagination?如何使用分页缓存索引页?
【发布时间】:2014-07-03 06:32:52
【问题描述】:

假设这是我的管理模型之一

ActiveAdmin.register Theme do
  menu :if => proc{ current_admin_user.super_admin?}

  after_filter :only => [:create, :update, :destroy] do
    expire_action :action => :show
    expire_action :action => :index
  end

  controller do
    caches_action :index, :show
  end
end

此代码缓存已完成,但在带有分页的索引页面上我面临问题,即我无法访问主题的另一个页面。

如何实现这样的事情 https://github.com/amatsuda/kaminari#creating-friendly-urls-and-caching

【问题讨论】:

    标签: ruby caching ruby-on-rails-4 pagination activeadmin


    【解决方案1】:

    这就是解决问题的方法:

    caches_action :index, :cache_path => Proc.new { |c| c.params }
    

    这将为特定的分页参数生成新的缓存

    Read More

    【讨论】:

      猜你喜欢
      • 2012-05-30
      • 2013-11-09
      • 2020-06-23
      • 1970-01-01
      • 2017-08-25
      • 2016-01-02
      • 2020-09-28
      • 1970-01-01
      • 2011-05-24
      相关资源
      最近更新 更多