aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb24
-rw-r--r--actionpack/lib/action_controller/new_base/compatibility.rb2
-rw-r--r--actionpack/lib/action_controller/new_base/testing.rb8
3 files changed, 22 insertions, 12 deletions
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)
diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb
index b3190486e8..4245ba982b 100644
--- a/actionpack/lib/action_controller/new_base/compatibility.rb
+++ b/actionpack/lib/action_controller/new_base/compatibility.rb
@@ -83,7 +83,7 @@ module ActionController
@@cache_store = ActiveSupport::Cache.lookup_store(store_option)
end
end
-
+
def initialize(*)
super
@template = _action_view
diff --git a/actionpack/lib/action_controller/new_base/testing.rb b/actionpack/lib/action_controller/new_base/testing.rb
index d8c3421587..78051a6252 100644
--- a/actionpack/lib/action_controller/new_base/testing.rb
+++ b/actionpack/lib/action_controller/new_base/testing.rb
@@ -1,5 +1,6 @@
module ActionController
module Testing
+ extend ActiveSupport::DependencyModule
# OMG MEGA HAX
def process_with_new_base_test(request, response)
@@ -26,5 +27,12 @@ module ActionController
@_response ||= ActionDispatch::Response.new
@_response.headers.replace(new_headers)
end
+
+ module ClassMethods
+ def before_filters
+ _process_action_callbacks.find_all{|x| x.kind == :before}.map{|x| x.name}
+ end
+ end
+
end
end