私のRailsアクションキャッシングが適切なURLリクエストとパラメータに基づいてキャッシュされない理由を理解しようとしています.
たとえば、 をリクエストするpage/2と、キャッシュ システムは を返しますpage。
これは、奇妙な応答のログのサンプルです。
Started GET "/clips/page/2" for 127.0.0.1 at 2012-08-11 16:46:42 -0400
Processing by ClipsController#index as HTML
  Parameters: {"page"=>"2"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Cache read: views/localhost:3000/clips/page
Read fragment views/localhost:3000/clips/page (0.3ms)
  Rendered text template within layouts/application (0.0ms)
Completed 200 OK in 50ms (ActiveRecord: 0.2ms)
私が奇妙だと思うのは、明らかに求められている URL が/clips/page/2であるのに対し、応答は "fragment" を読んでいることですRead fragment views/localhost:3000/clips/page (0.3ms)。
私のコントローラーには次のものがあります:
caches_action :index, :layout => false
そして非常に単純な index アクション:
def index
    @clips = current_user.clips.page(params[:page]).order('created_at DESC')
    respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @clips }
    end
end
これをテストしている私のdevelopment.rb構成ファイルでは、次のようにキャッシュが有効になっています。
  # caching
  config.perform_caching = true # cache test
  config.action_controller.perform_caching = true # cache test
  # config.action_controller.perform_caching = false # default
  config.cache_store = :dalli_store, 'localhost:11211'
私はキャッシュに関するこのチュートリアルを読んでいます: http://broadcastingadam.com/2012/07/advanced_caching_part_1-caching_strategies/
そして、私の状況とほぼ同じである例では、適切な応答が得られます。
Started GET "/posts/2" for 127.0.0.1 at 2011-05-01 16:54:43 -0700
  Processing by PostsController#show as HTML
  Parameters: {"id"=>"2"}
Read fragment views/localhost:3000/posts/2 (0.5ms)
Rendered posts/show.html.erb within layouts/application (6.1ms)
Write fragment views/localhost:3000/posts/2 (0.5ms)
Completed 200 OK in 16ms (Views: 8.6ms | ActiveRecord: 0.1ms)