Permalink
Browse files

Rails 3 fix for cache blocks

  • Loading branch information...
winton committed Nov 7, 2011
1 parent b96065d commit a06e14c5c2ef676d6653d04e727e4ec83faf6913
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/background_cache/helper.rb
@@ -9,7 +9,13 @@ def cache_with_background_cache(name = {}, options = nil, &block)
# http://railsapi.com/doc/rails-v2.3.8/classes/ActionView/Helpers/CacheHelper.html
# ActionController::Caching::Fragments#fragment_for (undocumented)
# actionpack/lib/action_controller/caching/fragments.rb
- if @controller.perform_caching
+ perform_caching =
+ if @controller.respond_to?(:perform_caching)
+ @controller.perform_caching
+ else
+ ActionController::Base.perform_caching
+ end
+ if perform_caching
cache = @controller.read_fragment(name, options)
match = (
BackgroundCache.active? &&

0 comments on commit a06e14c

Please sign in to comment.