I have this html
<tr <% if ap.overdue? %>class = "overdue"<% end %> >
<td><%= ap.id %></td>
<td><%= link_to ap.affiliate.title, superadmin_affiliate_path(ap.affiliate) %></td>
</tr>
How do I code the equivalent in HAML?
In particular the first line, which assigns a class only if the if
condition is true.
Try this
%tr{ :class => ("overdue" if ap.overdue?) }
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