diff options
author | José Valim <jose.valim@gmail.com> | 2012-05-02 13:40:16 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-05-02 13:40:16 -0700 |
commit | b656134450d5d49d79ae288a537df64795e9d34d (patch) | |
tree | d73cdec459220277570f09a991674044fab4b88a /actionpack/lib/action_controller | |
parent | 2914b92048e0cee970d019b333f6e47bf42a4270 (diff) | |
parent | 9a41edf0d9bdd757963aed9885cd4bfce324d613 (diff) | |
download | rails-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.rb | 6 |
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] |