사이트의 카트 부분을 완성하고 싶습니다. 처음 내가 그것을 괜찮 카트에 항목을 추가 할 수 있지만 같은 항목과 두 번째 시간 나는 오류 얻을 것이다 :정의되지 않은 메소드 '+'for nil : NilClass
undefined method `+' for nil:NilClass
Extracted source (around line #19):
current_item = line_items.find_by_product_id(product_id)
if current_item
current_item.quantity += 1
else
current_item = line_items.build(product_id: product_id)
end
잘못 무엇입니까?
감사합니다.
작동합니다. 감사합니다. – Ziu