ActiveRecord::PendingMigrationErrorへの対処
- ActiveRecord::PendingMigrationErrorが表示され、ホーム画面が表示されない状態となりました
- マイグレーションが保留になっている?
「ActiveRecord::PendingMigrationError」と出た時のエラー解決方法【rails】 - Qiita - 確かに
rails db:migrate
を実行できていませんでした
[vagrant@localhost sample_app2]$ rails db:migrate
Rails Error: Unable to access log file. Please ensure that /home/vagrant/environment/sample_app2/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /home/vagrant/environment/sample_app2/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
- パーミッションのエラーっぽいので、対象のファイルのパーミッションを変更しましたが、解決しません
[vagrant@localhost sample_app2]$ rails db:migrate
rails aborted!
NameError: undefined local variable or method `ip' for main:Object
/home/vagrant/environment/sample_app2/db/migrate/20190507092859_create_microposts.rb:12:in `<top (required)>'
/home/vagrant/environment/sample_app2/bin/rails:9:in `require'
/home/vagrant/environment/sample_app2/bin/rails:9:in `<top (required)>'
/home/vagrant/environment/sample_app2/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Caused by:
NameError: undefined local variable or method `ip' for main:Object
/home/vagrant/environment/sample_app2/db/migrate/20190507092859_create_microposts.rb:12:in `<top (required)>'
/home/vagrant/environment/sample_app2/bin/rails:9:in `require'
/home/vagrant/environment/sample_app2/bin/rails:9:in `<top (required)>'
/home/vagrant/environment/sample_app2/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
- migrationファイルの末尾に「ip」という文字を誤って入力してたのが原因でした、、、
- migrationファイルを修正し解決しました!!