我得到錯誤:數組:索引-7的出陣列
index -7 out of array
什麼是錯我的陣列?我不能儲存太多數字,或者是什麼?
修訂
PS - (從JSON我只得到IDS)
answers_from_json = ActiveSupport::JSON.decode(params[:answers_from_json])
answers_from_json.each_with_index do |item, i|
posts = Post.find(:all, :conditions => ["id=?",item.to_i])
sheet[header_y_offset-1,0] = 'Name'
posts.each_with_index do |post,i|
sheet[1+i,0] = post.name
end
end
如果您發佈數組,這將會很有幫助。 – bento 2012-07-26 10:42:27
我的猜測是,你寫了一些代碼,做的事情不是你的意思。但是我沒有看到它就說不出來。 – 2012-07-26 10:42:28
你的問題就像是:「我有一個錯誤,你知道解決方案嗎?」。更多信息plz! – Pigueiras 2012-07-26 10:43:10