I’m rendering the following html fragment…
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<%= yield %>
</div>
</div>
</div>
… like this:
<%= render :layout => "shared/menu" do %>
...code here...
<% end %>
Now in order to clean up things even more, I’d like to hide the render in a helper, in order to have something like:
<%= bs_menu do %>
...code here...
<% end %>
I’ve tried without success the following helper:
def bs_menu(&block)
render(:layout => "shared/menu") &block
end
I get this error from rails (3.2.1):
You invoked render but did not give any of :partial, :template,
:inline, :file or :text option.
What am I doing wrong?
I think you can also do this:
(Maybe you can also ommit the curly braces). This is a my standard way of passing blocks to methods.