Conditional class in HAML
haml, html, ruby-on-rails
Solution
Try this
%tr{ :class => ("overdue" if ap.overdue?) }
Problem
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.