diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-06-08 21:56:24 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-06-08 21:56:24 +0200 |
commit | 73715f29ab4c56ebcd74403903ebd691677ef318 (patch) | |
tree | bad272ccbb673cda8a997985aac0a972729266c7 | |
parent | 8240636beda7b2b487217be1d945eb0d36145c4d (diff) | |
download | rails-73715f29ab4c56ebcd74403903ebd691677ef318.tar.gz rails-73715f29ab4c56ebcd74403903ebd691677ef318.tar.bz2 rails-73715f29ab4c56ebcd74403903ebd691677ef318.zip |
Don't rely on the @view_renderer being defined.
That won't be true for Action Pack and Action Mailer.
-rw-r--r-- | actionview/lib/action_view/helpers/cache_helper.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index d515556e23..b7c7324f31 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -234,10 +234,10 @@ module ActionView def fragment_for(name = {}, options = nil, &block) if content = read_fragment_for(name, options) - @view_renderer.cache_hits[@virtual_path] = :hit + @view_renderer.cache_hits[@virtual_path] = :hit if defined?(@view_renderer) content else - @view_renderer.cache_hits[@virtual_path] = :miss + @view_renderer.cache_hits[@virtual_path] = :miss if defined?(@view_renderer) write_fragment_for(name, options, &block) end end |