Dynamic class name in HAML
erb, haml
Solution
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
Problem
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?!?