From: Tom Hughes Date: Thu, 22 Jul 2010 18:53:11 +0000 (+0100) Subject: Don't cache actions with a page number X-Git-Tag: live~6317^2~3 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/af70363d029202b53c5813e06117dfdc1208cccd Don't cache actions with a page number --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c50c5f664..1605e1133 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -249,6 +249,16 @@ class ApplicationController < ActionController::Base options = actions.extract_options! cache_path = options[:cache_path] || Hash.new + options[:unless] = case options[:unless] + when NilClass then Array.new + when Array then options[:unless] + else unlessp = [ options[:unless] ] + end + + options[:unless].push(Proc.new do |controller| + controller.params.include?(:page) + end) + options[:cache_path] = Proc.new do |controller| cache_path.merge(controller.params).merge(:locale => I18n.locale) end