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 

<li>
<%= link_to "#" do %>
购物车 <i class="fa fa-shopping-cart"> </i> ( <%= current_cart.products.count %> )
<% end %>
</li>
<% 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'

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容