The simplest way to do this is to define an a comment method in the application_helper.rb:
def comment(&block)
#block the content
end
And use it in rhtml templates
<% comment do %>
.. Some HTML
.. Some ruby scriptlets
<% end %>
How this works:
def x(&block) # x is a 0 param function
y(block) # y is a 1 param function (taking one "Proc")
z(&block) # z is a 0 param function (like x) with the block x received
<% comment do %>
.. Some HTML
.. Some ruby scriptlets
<% end %>
How this works:
def x(&block) # x is a 0 param function
y(block) # y is a 1 param function (taking one "Proc")
z(&block) # z is a 0 param function (like x) with the block x received
end
So, if you call z(&block) it's (nearly!!) the same as calling z { yield }: You just pass the block to the next function.
So, if you call z(&block) it's (nearly!!) the same as calling z { yield }: You just pass the block to the next function.