I have created a haml-partial which I want to use as a default header. When rendering this out I optionally want to give it a block to replace a part of the default content.
I've tried multiple things:
render partial: "partial", capture: do
# Don't really know why I tried this, Syntax error ofcourse.
render partial: "partial" do
# 'nil' is not an ActiveModel-compatible object. It must implement :to_partial_path.
render layout: "partial" do
# Works, but:
render layout: "partial"
# You invoked render but did not give any of :partial, :template, :inline, :file or :text option.
# So, it always needs the block
Any other options I don't know of?
Use render layout: ""
when you need a block.
Use render partial: ""
when you don't use a block.
They both work with locals and look for a pre-underscored file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With