この種のエラーが発生しています。以前は適切に着用していましたが、エラーの原因の一部です。
undefined method `save' for 2:Fixnum
そして、これは line_item_controller.rb/create の私のコードです
def create
@cart = current_cart
product = Product.find(params[:product_id])
@line_item = @cart.add_product(product.id)
respond_to do |format|
if @line_item.save
format.html { redirect_to store_url}
format.js { @current_item = @line_item }
format.json { render :json => @line_item, :status => :created, :location => @line_item }
else
format.html { render :action => "new" }
format.json { render :json => @line_item.errors, :status => :unprocessable_entity }
end
end
end
助けてください!