I’m working through the book right now, i’ve used rails for awhile, and wanted to check out the new edition. I may just be missing something simple but in Task G of the Atom Builder we call
@product = Product.find(params[:id])
latest_order = @product.orders.sort_by(&:updated_at).last
Did we ever define a relationship between Product, and Order ? A product has many line_items, and an order belongs_to line_items, but it doesn’t look like we ever explicitly link order and product (i’m getting a no method error).
Please forgive me if this is something trivial, though i’m not able to find the linking code at this time.