I need this construction in my HAML code:
- if something1
%div.a
- elsif something2
%div.b
- elsif something3
%div.c
- else
%div.d
%div another content
I would expected I get something like:
<div class="a|b|c|d">
<div>another content</div>
</div>
But in the fact I get
<div class="a|b|c|d"></div>
<div>another content</div>
How I must to update my code, if I need to get:
another content
?
I think you should create a helper method instead:
The really ugly way to accomplish this is with ternary operators
(condition ? true_case : false_case)which doesn’t sound like a good solution given from the fact that you selected haml and want to have your code base clean.