def batch_update
quantity_caritem=params[:items]
quantity_caritem.size.times.each do |i|
caritem_id=quantity_caritem["#{i}"][:caritem_id]
quantity = quantity_caritem["#{i}"][:quantity]
@caritem = Caritem.find_by(:id=>caritem_id)
@caritem.update(:quantity=>quantity)
end
@caritems = current_user.caritems
render_success @caritems, :include=>{
:product=>{
:include=>[:product_images, :master],
:method=>[:has_variants],
:except=>[:description]
},
:variant=>{
:methods=>[:options_key, :options_label]
}
}, :methods=>[:price]
end
这是控制台记录传来的参数
parameters = {"items"=>{"0"=>{"caritem_id"=>"24", "quantity"=>"4"}, "1"=>{"caritem_id"=>"25", "quantity"=>"6"}}, "controller"=>"api/caritems", "action"=>"batch_update"}
但是 debug模式下quantity_caritem为nil
请问下各位是哪里错了!
谢谢!