新たにカラムを追加する際、エラーが出てきました

StandardError: An error has occurred, this and all later migrations canceled:

undefined method `shop_id' for

原因はマイグレーションを叩く前にモデルにバリデーションをかけていたことが要因でした。

一旦バリデーションをコメントしてからもう一度叩いたら、問題なくマイグレーションが通りました!

参考にした記事

Rake aborted. Migrate aborted. Standard Error. Undefined Method. So what exactly causes this?
[db:migrate] error on migration – undefined method `file_changed?’ #195

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA