aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-05-02 13:40:16 -0700
committerJosé Valim <jose.valim@gmail.com>2012-05-02 13:40:16 -0700
commitb656134450d5d49d79ae288a537df64795e9d34d (patch)
treed73cdec459220277570f09a991674044fab4b88a /actionpack/lib/action_controller
parent2914b92048e0cee970d019b333f6e47bf42a4270 (diff)
parent9a41edf0d9bdd757963aed9885cd4bfce324d613 (diff)
downloadrails-b656134450d5d49d79ae288a537df64795e9d34d.tar.gz
rails-b656134450d5d49d79ae288a537df64795e9d34d.tar.bz2
rails-b656134450d5d49d79ae288a537df64795e9d34d.zip
Merge pull request #6125 from ncri/master
Adding proc evaluation for action caching layout parameter
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb
index 59ec197347..80901b8bf3 100644
--- a/actionpack/lib/action_controller/caching/actions.rb
+++ b/actionpack/lib/action_controller/caching/actions.rb
@@ -133,6 +133,8 @@ module ActionController #:nodoc:
end
def filter(controller)
+ cache_layout = @cache_layout.respond_to?(:call) ? @cache_layout.call(controller) : @cache_layout
+
path_options = if @cache_path.respond_to?(:call)
controller.instance_exec(controller, &@cache_path)
else
@@ -144,13 +146,13 @@ module ActionController #:nodoc:
body = controller.read_fragment(cache_path.path, @store_options)
unless body
- controller.action_has_layout = false unless @cache_layout
+ controller.action_has_layout = false unless cache_layout
yield
controller.action_has_layout = true
body = controller._save_fragment(cache_path.path, @store_options)
end
- body = controller.render_to_string(:text => body, :layout => true) unless @cache_layout
+ body = controller.render_to_string(:text => body, :layout => true) unless cache_layout
controller.response_body = body
controller.content_type = Mime[cache_path.extension || :html]