aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-19 18:05:16 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-19 18:11:45 -0700
commit67cc021d019515c94d4bcc4c3c7060c9a2594c87 (patch)
tree85592ebb6480ee6772e6d9b1d9b31b15ec3ca4b2 /actionpack/lib
parent0e7da0e4a06f78ab39b0e90daadfc223b8f1738a (diff)
downloadrails-67cc021d019515c94d4bcc4c3c7060c9a2594c87.tar.gz
rails-67cc021d019515c94d4bcc4c3c7060c9a2594c87.tar.bz2
rails-67cc021d019515c94d4bcc4c3c7060c9a2594c87.zip
Modified caching implementation to work with NewBase
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb22
-rw-r--r--actionpack/lib/action_controller/new_base/renderer.rb5
2 files changed, 24 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb
index 2b822b52c8..430db3932f 100644
--- a/actionpack/lib/action_controller/caching/actions.rb
+++ b/actionpack/lib/action_controller/caching/actions.rb
@@ -61,8 +61,14 @@ module ActionController #:nodoc:
filter_options = { :only => actions, :if => options.delete(:if), :unless => options.delete(:unless) }
cache_filter = ActionCacheFilter.new(:layout => options.delete(:layout), :cache_path => options.delete(:cache_path), :store_options => options)
- around_filter(filter_options) do |controller, action|
- cache_filter.filter(controller, action)
+
+ # TODO: Remove this once new base is swapped in.
+ if defined?(Http)
+ around_filter cache_filter, filter_options
+ else
+ around_filter(filter_options) do |controller, action|
+ cache_filter.filter(controller, action)
+ end
end
end
end
@@ -85,14 +91,22 @@ module ActionController #:nodoc:
@options = options
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)
+ end
+
def before(controller)
cache_path = ActionCachePath.new(controller, path_options_for(controller, @options.slice(:cache_path)))
+
if cache = controller.read_fragment(cache_path.path, @options[:store_options])
controller.rendered_action_cache = true
set_content_type!(controller, cache_path.extension)
@@ -129,7 +143,9 @@ module ActionController #:nodoc:
end
def content_for_layout(controller)
- controller.template.layout && controller.template.instance_variable_get('@cached_content_for_layout')
+ # TODO: Remove this when new base is merged in
+ template = controller.respond_to?(:template) ? controller.template : controller._action_view
+ template.layout && template.instance_variable_get('@cached_content_for_layout')
end
end
diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb
index 8a9f230603..9253df53a1 100644
--- a/actionpack/lib/action_controller/new_base/renderer.rb
+++ b/actionpack/lib/action_controller/new_base/renderer.rb
@@ -9,6 +9,11 @@ module ActionController
super
end
+ def response_body=(body)
+ response.body = body if response
+ super
+ end
+
def render_to_body(options)
_process_options(options)