添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Jumpstart Rails SaaS Template

Launch your product business way faster with our SaaS template.

Other
Remote Ruby Podcast

A weekly podcast on web development and building products with Ruby, Rails, Javascript, and more.

I'm trying to make a blogging app with rails and I'm currently trying to add a comment section. When I tried looking on one of my blogs it gave me this error.

ActiveRecord::StatementInvalid in Posts#show

SQLite3::SQLException: no such column: comments.post_id
Extracted source (around line #16):

<%= @post.comments.count %> Comments

<%= render @post.comments %>

Add a Comment:

<%= render 'comments/form' %>

I have no I idea of what's going on.

Reply

Since it says your comments table has no post_id column, you should check your migrations and make sure you didn't forget to add the column. :)

Reply Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8 Twitter