All threads / SQLite3::SQLException: no such column:

Ask A Question

Notifications

You’re not receiving notifications from this thread.

SQLite3::SQLException: no such column:

Hilldamn asked in Rails

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):


Comments

<%= render @post.comments %>

Add a Comment:

<%= render 'comments/form' %>

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

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. :)

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 38,558+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.