I'm trying to put a conditional for a style attribute. According to this answer something like this should be possible:
.hello{:style => (true ? 'color: green' : 'color: red;')}
But for me the style attribute doesn't get outputted at all. Did things change in Haml? I rather not create a helper for such simple logic.
I would take the easy route out and add a line:
The even easier way is to add a further class and control it from the css/javascript as needs be:
This would give you
<div class='hello success'></div>
Edit: the ternary seems to work too, though