diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-22 17:23:54 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-22 17:59:55 -0800 |
commit | 52eafbd7495367aa48192100a922181d097e5b22 (patch) | |
tree | b5a1ebd68101b6cd97b42f762da8e5b1d0ef8498 /actionview/lib/action_view/renderer | |
parent | a796de1bd644b54e2c27577319c262af0de56e8f (diff) | |
download | rails-52eafbd7495367aa48192100a922181d097e5b22.tar.gz rails-52eafbd7495367aa48192100a922181d097e5b22.tar.bz2 rails-52eafbd7495367aa48192100a922181d097e5b22.zip |
Add a finalizer to inline templates
This commit adds a finalizer just to inline templates. We can't cache
compilation of inline templates because it's possible that people could
have render calls that look like this:
```ruby
loop do
render inline: "#{rand}"
end
```
and we would cache every one of these different inline templates. That
would cause a memory leak. OTOH, we don't need finalizers on regular
templates because we can cache, control, and detect changes to the
template source.
Fixes: #35372
Diffstat (limited to 'actionview/lib/action_view/renderer')
-rw-r--r-- | actionview/lib/action_view/renderer/template_renderer.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb index a129ef0e15..87f6cf3de3 100644 --- a/actionview/lib/action_view/renderer/template_renderer.rb +++ b/actionview/lib/action_view/renderer/template_renderer.rb @@ -34,7 +34,7 @@ module ActionView else @lookup_context.formats.first end - Template.new(options[:inline], "inline template", handler, locals: keys, format: format) + Template::Inline.new(options[:inline], "inline template", handler, locals: keys, format: format) elsif options.key?(:template) if options[:template].respond_to?(:render) options[:template] |