vendredi 22 juillet 2016

Rails - Condicional if sintaxis

Im starting with rails, and i cant write this on a rails sintaxis. Can i use the variable like this? How can i compare 2 variables with the true , false format?.

 <% n = 0 %>
 <% @clas.each do |f| %>
    <% if f.clas_id != n %>
        <div>
            <h2> <%= f.clas_id%></h2>
        </div>
    <% else %>
      <% if f.clas_id = n %>
        <div class = "title">
            <h3><%= f.name%></h3>
            <table>
                <tr>
                    <th>PA</th>
                    <th>Disim.</th>
                </tr>
                <tr>
                    <td><%= f.prec_id %></td>
                    <td><%= f.dis_id %></td>
                </tr>
            </table>
        </div>
        <% else %>
            <% n = f.clase_id %><%= n %>
    <% end %>
   <% end %>
<% end %>

THKs

Aucun commentaire:

Enregistrer un commentaire