From 10085114ce7ec6bc967fa701c49ef218f666efb5 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Mon, 25 May 2009 18:05:58 +0200 Subject: Make Filter#filter work with around filters --- .../lib/action_controller/caching/actions.rb | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'actionpack/lib/action_controller/caching') diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index 430db3932f..3646ff1af9 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -63,7 +63,7 @@ module ActionController #:nodoc: cache_filter = ActionCacheFilter.new(:layout => options.delete(:layout), :cache_path => options.delete(:cache_path), :store_options => options) # TODO: Remove this once new base is swapped in. - if defined?(Http) + if defined?(ActionController::Http) around_filter cache_filter, filter_options else around_filter(filter_options) do |controller, action| @@ -92,16 +92,18 @@ module ActionController #:nodoc: end # TODO: Remove once New Base is merged - def filter(controller, action) - should_continue = before(controller) - action.call if should_continue - after(controller) - end - - def around_process_action(controller) - should_continue = before(controller) - yield if should_continue - after(controller) + if defined?(ActionController::Http) + def around_process_action(controller) + should_continue = before(controller) + yield if should_continue + after(controller) + end + else + def filter(controller, action) + should_continue = before(controller) + action.call if should_continue + after(controller) + end end def before(controller) -- cgit v1.2.3