Agile Web Development with Rails 6 and later software updated to Rails 7:

Will do. However, I will be away from my Laptop until Wed 30th. Sorry for the late notice.

[quote=“davetron5000, post:20, topic:120108”]
Hi, I’m back. I noticed that on app/views/carts/_cart.html.erb p. 177, a class: “checkout” was added after the method: :get,<%= button_to 'Checkout', new_order_path, method: :get %>
That means the checkout button code snippet would indicate as follows:
<%= button_to ‘Checkout’,
new_order_path, method: :get, class: “checkout” %>
I’m making sure the code on Chapter 12. Task G: Check Out! matches what the book says.

When I click the checkout button I get the following undefined method ‘errors’, although the code snippet matches what the book on p. 180 says for the partial views/orders/_form.html.erb:

NoMethodError in Orders#new

Showing C:/railsdepot1/depot1/app/views/orders/_form.html.erb where line #2 raised:

undefined method `errors' for nil:NilClass

'.freeze;   if order.errors.any? 
                    ^^^^^^^

Extracted source (around line #2):

|1 2 3 4 5 6|<%= form_with(model: order, local: true) do |form| %>

<% if order.errors.any? %>

<%= pluralize(order.errors.count, "error") %> prohibited this order from being saved:

    | | --- | --- | --- |

    Trace of template inclusion: #<ActionView::Template app/views/orders/new.html.erb locals=[]>

    Rails.root: C:/railsdepot1/depot1

    Any thoughts on that?

This code snippet (from AI) was hindering the form to display: def new
puts “IN NEW!”
@order = Order.new
end
Code snippet was taken out.
The form displays correctly now!

Done !