我无法在我需要的视图中打印迭代时间 - i
var不会增长:
- i=0; @movies[0..3].each do |movie|
<input type="checkbox" name="ratings" value="#{i}">#{movie.rating}</input>
- i++;
应该改变什么?
答案 0 :(得分:2)
-@movies[0..3].each_with_index do |movie, i|
%input{:type=>"checkbox" :name=>"ratings" :value=>i}
%label
=movie.rating