tags:

views:

45

answers:

1

in ruby you can do conditional block like so

block do |n|
  puts n
end if foo == bar

which would translate into erb as

<% block do |n| %>
  <%= n %>
<% end if foo == bar %>

is there a way to achieve this in haml other than wrapping the block in a condition?

+3  A: 
- block do |n|
  = n
- end if foo == bar

Haml does allow end in this circumstance.

nex3
Neat! I did not know this. Upvoted!
Richard Cook