A
A
Alexander Petrov2016-03-03 15:50:52
Ruby on Rails
Alexander Petrov, 2016-03-03 15:50:52

How to write this code in haml?

I will give an example of how I would write in erb

<div class="point <%if params[:id]==point.id%>active_point<%end%>">
</div>

how to do the same in haml?
I have an iteration of elements. If the id matches the id of the page, then the item must be made active.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vadimstroganov, 2016-03-03
@Mirkom63

- klass = 'active_point' if params[:id] == point.id
%div{:class => "code #{klass}"}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question