Couldn't find Order without an ID

Friday, July 11, 2014

I'm a rails rookie with a weak understanding of the backend, and a difficult time learning it. I'm trying to get product, order, cart, and line item models and controllers in sync for a "simple" ecommerce app. Running into the following issue, which my go-to "mentor" does not have an answer for (or is tired of my questions).


ActiveRecord::RecordNotFound in LineItemsController#create


Couldn't find Order without an ID


Extracted source (around line #7):



@cart = current_cart
@product = Product.find(params[:product_id])
@order = Order.find(session[:order_id])

line_item = @order.line_items.build(line_item_attributes)


I'm not sure which other code is relevant enough to insert here. Please let me know what else I can provide.


I notice that some gentlemen on here enjoy snapping at young foolish rookies like myself; if thats you, hold back.


Thank you.







http://ift.tt/1y59A4N