I am trying to build a bootstrap carousel on my page. The carousel needs to look like this, with the first element having an active class.
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
How do I achieve the same thing in Ruby? Can I print the data slide number, and the active class from the same statement.
<ol class="carousel-indicators">
<% @order_items.each_index do |n| %>
<li data-target="#carousel-order-item" data-slide-to=<%= "#{n}"; (n == 0) ? "class="active"" : '' %>></li>
<% end %>
</ol>
Thanks!