Answer the question
In order to leave comments, you need to log in
I can't understand the logic. How to do it right?
<ul class="rating">
<% 1.upto(5) do |count| %>
<li class=<%= if product.rate == count then 'star selected' else 'star' end %> >☆</li>
<% end %>
</ul>
<ul class="rating">
<li class="star">☆</li>
<li class="star">☆</li>
<li class="star selected">☆</li>
<li class="star">☆</li>
<li class="star">☆</li>
</ul>
<ul class="rating">
<li class="star">☆</li>
<li class="star">☆</li>
<li class="star">☆</li>
<li class="star" selected="">☆</li>
<li class="star">☆</li>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question