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.

Was it helpful?

Solution

Not sure. Maybe:

%span{:class => item.dashboardstatus.cssclass }= item.dashboardstatus.status

OTHER TIPS

This worked.

Where ever the link is to the page do something like this

  %div{"data-turbolinks" => "false"}
    = link_to 'Send payment', new_payments_manager_path(sender_id: current_user.id, receiver_id: @collaboration.with(current_user).id, collaboration_id: params[:id]), class: 'button'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top