Skip to content

Commit 30d1de9

Browse files
committed
Fix bug when render is called without a block
1 parent 8cdbcb0 commit 30d1de9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/view_component/base.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def render(options = {}, args = {}, &block)
259259
# We assume options is a component, so there's no need to evaluate the
260260
# block in the view context as we do below.
261261
@view_context.render(options, args, &block)
262-
else
262+
elsif block
263263
__vc_original_view_context.render(options, args) do
264264
# Partials are rendered to their own buffer and do not append to the
265265
# original @output_buffer we retain a reference to in #render_in. This
@@ -270,6 +270,8 @@ def render(options = {}, args = {}, &block)
270270
# created for the partial.
271271
__vc_original_view_context.instance_exec(&block)
272272
end
273+
else
274+
__vc_original_view_context.render(options, args)
273275
end
274276
end
275277

0 commit comments

Comments
 (0)