small medium large xlarge

Generic-user-small
19 Sep 2010, 15:12
david cates (3 posts)

following along in agile web development code depot_j page 156, when I add the code

Your Cart</div>

<%= render(cart.line_items) %> Total <%= number_to_currency(cart.total_price) %>

<%= button_to ‘Empty cart’, cart, :method => :delete, :confirm => ‘Are you sure?’ %>

and then

<%= render @cart %>

i get the error oMethodError in Line itemsController#create

undefined method `price=’ for # Rails.root: /Users/davidc1947/rails/depot

Application Trace | Framework Trace | Full Trace app/models/cart.rb:18:in add_product' app/controllers/line_items_controller.rb:53:in create’ Request

Parameters:

{“product_id”=>”3”, “authenticity_token”=>”wiKqkR6sS4edEJlVetWbfOsnqvkm41+OBNEyGoVaGtM=”} Show session dump

Show env dump

Response

Headers:

None

Why???

Photo_on_2010-05-01_at_22.39_pragsmall
20 Sep 2010, 11:46
John H Simmonds (13 posts)

Maybe this line

<= render(cart.line_items) %>

</code> should be

<%= render(cart.line_items) %>

</code>


(maybe additional similar errors :-)

You must be logged in to comment