Reputation: 11820
I have this ERB:
<li class="<%= pill_class_for(:home, :index) %>"><a href="/">Home</a></li>
pill_class_for
is a is a helper function that returns a string representing a HTML class. How can I change this to HAML?
I tried this but it's stupid and doesn't work:
%li.= pill_class_for(:home, :index)<a href="/">Home</a>
You can see what I'm trying to do above but it results in a SyntaxError
(Illegal element: classes and ids must have values.
).
Many thanks.
Upvotes: 1
Views: 67
Reputation: 10208
Try the following
%li{:class => pill_class_for(:home, :index)}
%a{:href => "/"} Home
Upvotes: 2