레일로 시작하기 때문에 레일스 문법으로 작성할 수 없습니다. 이런 변수를 사용할 수 있습니까? 두 변수를 참, 거짓 형식과 어떻게 비교할 수 있습니까? 이 같은레일 - 문법이있는 경우 조건부
<% 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.clas_id %><%= n %>
<% end %>
<% end %>
<% end %>
무엇이 오류입니까? – webster
1) 어디에서나 정의 할'@ clas '를 볼 수 없다. 2) clas_id와 clase_id를 사용하고있다. 3) 조건을 잘 살펴보십시오 :'f.clas_id! = n'이 있고 반대 조건은 더 이상 조건으로 구성 될 수 없기 때문에 왼쪽이 없기 때문에 간단합니다! – Zelenka
1) '@clas'는 스코프와 거래하는 컨트롤러 인 '@clas = ACp.clas'입니다. 'scope : clas, lambda {order ("a_cps.clas_id DESC"). 그룹 ("a_cps.clas_id")}'. 2) 예, 동일합니다. – Chili