Help us understand the problem. What is going on with this article?

ActiveRecord::PendingMigrationError と言われた時の解決方法

More than 3 years have passed since last update.

RailsでブラウザからアクセスしたところPendingMigrationErrorエラーがでました。

PendingMigrationErrorがでる

以下がエラーの内容です。

エラー
ActiveRecord::PendingMigrationError (

Migrations are pending. To resolve this issue, run:

    bin/rake db:migrate RAILS_ENV=development

):

Migrationsが未解決なのでmigrateしろとあります。

rake db:migrate を実行

migrateします。

migrate
bundle exec rake db:migrate 
== 20150917031451 CreateActivities: migrating =================================
-- create_table(:activities)
   -> 0.0192s
-- add_index(:activities, [:trackable_id, :trackable_type])
   -> 0.0077s
-- add_index(:activities, [:owner_id, :owner_type])
   -> 0.0067s
-- add_index(:activities, [:recipient_id, :recipient_type])
   -> 0.0068s
== 20150917031451 CreateActivities: migrated (0.0415s) ========================

migrationファイルが実行され、ボクの環境の場合はactivitesテーブルが生成されました。

再度 rails s

serverをstart
bundle exec rails s -b 0.0.0.0 -p 8888

エラーがでなくなりました。
Migrationを保留しているというエラーだったのでMigrationを実行するとエラーが出なくなります。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした