Haml: how do I set a dynamic class value? *

Question

I have the following html.erb code that I'm looking to move to Haml:

<span class="<%= item.dashboardstatus.cssclass %>" ><%= item.dashboardstatus.status %></span>

What it does is associate the CSS class of the currently assigned status to the span.

How is this done in Haml? I'm sure I'm missing something really simple.

SOLVED: I can't believe I didn't figure that out on my own. Just goes to show that two sets of eyes are better than one. Thanks!

Answer

Not sure. Maybe:

%span{:class => item.dashboardstatus.cssclass }= item.dashboardstatus.status
< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/6326/" >Haml: how do I set a dynamic class value?< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment