Closed edorgeville closed 8 years ago
Also
irb(main):009:0> Post.first.comments
Post Load (0.6ms) SELECT "posts".* FROM "posts" ORDER BY date ASC LIMIT 1
Comment Load (0.3ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = ? ORDER BY created_at ASC [[nil, 5056]]
SQLite3::SQLException: no such column: comments.post_id: SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = ? ORDER BY created_at ASC
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: comments.post_id: SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = ? ORDER BY created_at ASC
Found it ! That was all my fault :sweat_smile:
In models/post.rb, I had forgotten to remove a line from our old comment integration :
class Post < ActiveRecord::Base
include ContentModule
acts_as_commentable
# has_many :comments # <----- wasn't commented
has_and_belongs_to_many :authors
has_and_belongs_to_many :categories
has_and_belongs_to_many :tags
:sob:
When trying to fetch comments I get the following error :
This happens right after using the
rails g comments
command and addingacts_as_commentable
toPost
. Any idea ?