30 Mar 2013, 03:35
Images_pragsmall

fcw (1 post)

Hello, I’m new on rails. These week, I just follow the book to learn. However, When it came to D3, the code:

  <h2>Your Pragmatic Cart</h2>
<ul>
<% @cart.line_items.each do |item| %>
<li><%= item.product.title %></li>
<% end %>
</ul>

run for it, it shows the error:

  undefined method `title' for nil:NilClass

and when I test:functionals,it shows that:

 1) Error:
test_should_create_cart(CartsControllerTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: table line_items has no column named product_id: INSERT INTO "line_items" ("product_id", "id", "updated_at", "cart_id", "created_at") VALUES (64810937, 298486374, '2013-03-30 02:29:35', 1, '2013-03-30 02:29:35')

and my rails’version is 3.2.13. Thans!!

  You must be logged in to comment