public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
phorsfall (author)
Sat Apr 19 14:19:47 -0700 2008
josh (committer)
Sat Apr 19 14:21:34 -0700 2008
commit  14a40804a29a57ad05ca6bffbe1e5334089593a9
tree    80e2d5f38334327a70a368cc2e57fc8c2e8f7c1c
parent  3f8d3cd04ff0bd7cbf70c11d49a3dc009dfa98a0
rails / actionpack / lib / action_controller / caching / sql_cache.rb
100644 18 lines (17 sloc) 0.448 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module ActionController #:nodoc:
  module Caching
    module SqlCache
      def self.included(base) #:nodoc:
        if defined?(ActiveRecord) && ActiveRecord::Base.respond_to?(:cache)
          base.alias_method_chain :perform_action, :caching
        end
      end
 
      protected
        def perform_action_with_caching
          ActiveRecord::Base.cache do
            perform_action_without_caching
          end
        end
    end
  end
end