user1049097
user1049097

Reputation: 1901

Is this the correct way of rendering a yield content_for?

<%= yield(:title_box) if content_for?(:title_box) %>

Or is the if condition useless here?

Upvotes: 0

Views: 58

Answers (1)

Mark Huk
Mark Huk

Reputation: 2380

The condition check is not needed as if nothing to render there is nothing will be outputted. See docs

Upvotes: 2

Related Questions