Rails 4, displays a partial / layout with an extra block inside haml

I created haml-partial which I want to use as the default header. When visualizing this option, I can optionally provide it with a block to replace part of the default content.

I have tried several 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 that I don't know about?

+7
ruby-on-rails ruby-on-rails-4 rendering partial-views haml
source share
1 answer

Use render layout: "" when you need a block.

Use render partial: "" when you are not using a block.

They work with locals and look for a pre-selected file.

+13
source share

All Articles