diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 24 |
2 files changed, 15 insertions, 11 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index ac1c568a94..fdf6fd7e8c 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Explicitly require active_record/query_cache before using it. [Jeremy Kemper] + * Fix layout overriding response status. #9476 [lotswholetime] * Add fieldset_tag for generating fieldsets, closes #9477. [djanowski] diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 3434f5f9da..e6e42b9126 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -12,7 +12,10 @@ module ActionController #:nodoc: module Caching def self.included(base) #:nodoc: base.send(:include, Pages, Actions, Fragments) - base.send(:include, Sweeping, SqlCache) if defined?(ActiveRecord) + if defined?(ActiveRecord) + require 'active_record/query_cache' + base.send(:include, Sweeping, SqlCache) + end base.class_eval do @@perform_caching = true @@ -656,20 +659,19 @@ module ActionController #:nodoc: end end end - - if defined?(ActiveRecord) - module SqlCache - def self.included(base) #:nodoc: + + module SqlCache + def self.included(base) #:nodoc: + if defined?(ActiveRecord) && ActiveRecord::Base.respond_to?(:cache) base.alias_method_chain :perform_action, :caching end - - def perform_action_with_caching - ActiveRecord::Base.cache do - perform_action_without_caching - end + end + + def perform_action_with_caching + ActiveRecord::Base.cache do + perform_action_without_caching end end end - end end |