Skip to content

Commit

Permalink
Fix Action View compatibility with jbuilder
Browse files Browse the repository at this point in the history
jbuilder is doing some weird things such as instantiatign RenderedTemplate
with a `Hash` instance as a `body`.

So we can't forcibly cast to string in these places.
  • Loading branch information
byroot committed Oct 21, 2022
1 parent b96ddea commit 05919b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actionview/lib/action_view/renderer/abstract_renderer.rb
Expand Up @@ -142,7 +142,7 @@ class RenderedTemplate # :nodoc:
attr_reader :body, :template

def initialize(body, template)
@body = body.to_s
@body = body
@template = template
end

Expand Down
2 changes: 1 addition & 1 deletion actionview/lib/action_view/template.rb
Expand Up @@ -180,7 +180,7 @@ def render(view, locals, buffer = nil, add_to_stack: true, &block)
view._run(method_name, self, locals, buffer, add_to_stack: add_to_stack, has_strict_locals: @strict_locals, &block)
nil
else
view._run(method_name, self, locals, OutputBuffer.new, add_to_stack: add_to_stack, has_strict_locals: @strict_locals, &block).to_s
view._run(method_name, self, locals, OutputBuffer.new, add_to_stack: add_to_stack, has_strict_locals: @strict_locals, &block)&.to_s
end
end
rescue => e
Expand Down

0 comments on commit 05919b0

Please sign in to comment.