0
0

More than 1 year has passed since last update.

StandardError: An error has occurred, this and all later migrations canceled:の解消法

Posted at

マイグレーションをする際に発生

class CreateInterviews < ActiveRecord::Migration[6.1]
  def change
    create_table :interviews do |t|
      t.integer :user_id
      t.string :title
      t.text :body
      t.timestamps
    end
  end
end

記述自体に問題はありませんでしたが、エラー文を確認すると、undefined local variable or method ` t' for #<....>と出ており、特にtに関するものを確認します。問題ありませんでしたが、t.の前に『全角のスペース』が入っていました。これを直すと無事マイグレーションできました。

初心者ほど凡ミスがないかを疑う

特に初学者ほどコマンドは慎重に書くと思いますが、こう言う見当たらないミスほど時間を費やすので、コマンド+f でそもそもの形式を確認してみるのも解決までの近道になりそうです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0