Skip to content

Commit 5451b57

Browse files
authored
Merge pull request #304 from stephannv/fix/instantiate_view_with_empty_template_cache
Instantiate view with empty template cache
2 parents 788eeba + bb7ec81 commit 5451b57

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/web_console/template.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(env, session)
1717

1818
# Render a template (inferred from +template_paths+) as a plain string.
1919
def render(template)
20-
view = View.new(ActionView::LookupContext.new(template_paths), instance_values)
20+
view = View.with_empty_template_cache.with_view_paths(template_paths, instance_values)
2121
view.render(template: template, layout: false)
2222
end
2323
end

test/web_console/interceptor_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class InterceptorTest < ActionDispatch::IntegrationTest
1414
end
1515

1616
def generate_template_error
17-
WebConsole::View.new(ActionView::LookupContext.new([])).render(inline: <<~ERB)
17+
lookup_context = ActionView::LookupContext.new([])
18+
WebConsole::View.with_empty_template_cache.with_context(lookup_context).render(inline: <<~ERB)
1819
<% @ivar = 42 %>
1920
<%= nil.raise %>
2021
</h1

0 commit comments

Comments
 (0)