aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/caching.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index c7f3e95617..d016d09baa 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -10,7 +10,8 @@ module ActionController #:nodoc:
# Note: To turn off all caching and sweeping, set Base.perform_caching = false.
module Caching
def self.included(base) #:nodoc:
- base.send(:include, Pages, Actions, Fragments, Sweeping)
+ base.send(:include, Pages, Actions, Fragments)
+ base.send(:include, Sweeping, SqlCache) if defined?(ActiveRecord)
base.class_eval do
@@perform_caching = true
@@ -612,5 +613,20 @@ module ActionController #:nodoc:
end
end
end
+
+ if defined?(ActiveRecord)
+ module SqlCache
+ def self.included(base) #:nodoc:
+ base.alias_method_chain :perform_action, :caching
+ end
+
+ def perform_action_with_caching
+ ActiveRecord::Base.cache do
+ perform_action_without_caching
+ end
+ end
+ end
+ end
+
end
end