You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How am I supposed to populate the OrderStatus table? I'm trying to process an order using stripe, but it is expecting the class to be populated:
def create @order = OrderItem.where("product_id = ? AND order_id = ?", params[:order_item][:product_id], session[:order_id]).first
if @order
@order.update(quantity: @order.quantity + params[:order_item][:quantity].to_i)
@order.save
else @order = current_order
@order.order_items.new(order_item_params) do
@order.order_status_id = 1
end
@order.save
session[:order_id] = @order.id
end
OrderItem is blank, I'm guessing, because this is the first order in the system. current_order is also blank, which seems strange. @order has an order_status_id of "1", which should map to OrderStatus(1), but there's nothing in OrderStatus yet, which is mind-boggling. Thanks in advance for any help.
The text was updated successfully, but these errors were encountered:
How am I supposed to populate the OrderStatus table? I'm trying to process an order using stripe, but it is expecting the class to be populated:
def create
@order = OrderItem.where("product_id = ? AND order_id = ?", params[:order_item][:product_id], session[:order_id]).first
if @order
@order.update(quantity: @order.quantity + params[:order_item][:quantity].to_i)
@order.save
else
@order = current_order
@order.order_items.new(order_item_params) do
@order.order_status_id = 1
end
@order.save
session[:order_id] = @order.id
end
OrderItem is blank, I'm guessing, because this is the first order in the system. current_order is also blank, which seems strange. @order has an order_status_id of "1", which should map to OrderStatus(1), but there's nothing in OrderStatus yet, which is mind-boggling. Thanks in advance for any help.
The text was updated successfully, but these errors were encountered: