データベースで関係を設定しようとすると問題が発生します。
ユーザーといくつかのコメントがあります (1:N)
Class User ..
...
has_many :comments
end
Class Comment ..
..
belongs_to :user
end
コンソールを介してユーザーにコメントを割り当てようとすると、次のように入力します: user.comments 次のエラーが表示されます。
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column:
comments.user_id: SELECT "comments".* FROM "comments" WHERE
"comments"."user_id" = 1
bundle exec db:test:prepare と移行を次のように実行しました
rails g migration CreateUsers .....
rails g migration CreateComments .....
db:schema:dump を試して再度移行しましたが、引き続き問題が発生します。