ActiveRecord::StatementInvalid in Products#index

Showing /Users/lvchengbo/jdstore/app/views/common/_navbar.html.erb where line #18 raised:

SQLite3::SQLException: no such column: cart_items.cart_id: SELECT COUNT(*) FROM "products" INNER JOIN "cart_items" ON "products"."id" = "cart_items"."product_id" WHERE "cart_items"."cart_id" = ?

Extracted source (around line **#18**):
161718192021 

  • <%= link_to "#" do %> 购物车 ( <%= current_cart.products.count %> ) <% end %>
  • <% if !current_user %>

    Trace of template inclusion: app/views/layouts/application.html.erb
    Rails.root: /Users/lvchengbo/jdstore

    Application Trace | Framework Trace | Full Traceapp/views/common/_navbar.html.erb:18:in block in _app_views_common__navbar_html_erb__861366649695980850_70202464562160'](http://localhost:3000/#)[app/views/common/_navbar.html.erb:17:in_app_views_common__navbar_html_erb__861366649695980850_70202464562160'app/views/layouts/application.html.erb:14:in `_app_views_layouts_application_html_erb___3704095119421627845_70202528987540'

    你可能感兴趣的:(ActiveRecord::StatementInvalid in Products#index)