Skip to content

Commit

Permalink
Merge pull request #251 from stephannv/render_nil
Browse files Browse the repository at this point in the history
Allow rendering nil
  • Loading branch information
joeldrapper authored Feb 1, 2025
2 parents 4cd9cb3 + 5f188f3 commit 0c6d713
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/phlex/rails/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def render(*args, **kwargs, &block)
return super if renderable < Phlex::SGML
when Enumerable
return super unless ActiveRecord::Relation === renderable
when nil
return super if kwargs.length == 0
end

return super if args.length == 0 && kwargs.length == 0
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/views/rendering/standard_phlex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
module Rendering
class StandardPhlex < ApplicationView
def view_template
render nil

render Header do
h1(id: "title") { "Hello Phlex!" }
end
Expand Down

0 comments on commit 0c6d713

Please sign in to comment.