Fixed that sweepers defined by cache_sweeper will be added regardless of the...

Fixed that sweepers defined by cache_sweeper will be added regardless of the perform_caching setting. Instead, control whether the sweeper should be run with the perform_caching setting. This makes testing easier when you want to turn perform_caching on/off [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8990 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 e1173500
*SVN*
* Fixed that sweepers defined by cache_sweeper will be added regardless of the perform_caching setting. Instead, control whether the sweeper should be run with the perform_caching setting. This makes testing easier when you want to turn perform_caching on/off [DHH]
* Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]
* Better error message for type conflicts when parsing params. Closes #7962 [spicycode, matt]
......
......@@ -36,7 +36,6 @@ def self.included(base) #:nodoc:
module ClassMethods #:nodoc:
def cache_sweeper(*sweepers)
return unless perform_caching
configuration = sweepers.extract_options!
sweepers.each do |sweeper|
......@@ -59,11 +58,11 @@ class Sweeper < ActiveRecord::Observer #:nodoc:
def before(controller)
self.controller = controller
callback(:before)
callback(:before) if controller.perform_caching
end
def after(controller)
callback(:after)
callback(:after) if controller.perform_caching
# Clean up, so that the controller can be collected after this request
self.controller = nil
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册