–> the word “order” in the 2nd line should be “Order”.
It’s “order” in my copy, and it works.
Aren’t you using “order” in the other form controls?
e.g.
text_field(“order”, “name”, “size” => 40 )
With respect to the NoMethodError, Rails should be providing
a “magic” pay_type accessor method, because you should have
a pay_type column in your orders table:
create table orders (
id int not null auto_increment,
name varchar(100) not null,
email varchar(255) not null,
address text not null,
pay_type char(10) not null,
shipped_at datetime null,
primary key (id)
);
(You may not have the shipped_at column yet - it gets added later in the
book)
Your checkout method should be creating a new Order and assigning it
to the instance variable @order
@order = Order.new
and when Rails renders the checkout.rhtml page, the controls (referring
to it as “order”) are picking up the contents of that Order via its
“magic” accessor methods.
Since the payment type select control is the first to complain, I
suspect that the pay_type column is missing or mistyped in your table
definition.
See figure 17.2 in the book (it’s on page 342 in the PDF) for a clear
picture of how all the pieces fit together.
regards
Justin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.