Is there a better way to convert the following to HAML?
<% flash.each do |key, value| %> <div class="flash <%= key %>"><%= value %></div> <% end %>
Best I can do is:
- flash.each do |key, value| %div{:class => "flash " + key.to_s}= value
But it seems awkward. And .flash#{ key}= value
doesn't seem to be right?!?
If you're looking for something every-so-slightly terser, you can do this now in haml:
- flash.each do |key, value| .flash(class=key)= value
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