执行RailsBridge教程步骤5时遇Migration Pending错误求助
Hey there! That migration pending error is totally normal when you're setting up a new Rails model—let's get this sorted out quickly.
Here's what you need to do:
Double-check you're in your Rails app's root directory
Open your terminal and make sure you're inside the folder you created withrails new(it should have subfolders likeapp/,db/, andconfig/).Run the database migration command
In the terminal, execute this command to apply your pending model migrations:rails db:migrateThis tells Rails to create the actual database table for your
Drinkmodel using the migration file generated when you created the model.Restart your Rails server (if it's running)
If you leftrails serverrunning in another terminal tab, pressCtrl + Cto stop it, then start it back up with:rails serverRails needs a restart to recognize the new database schema changes.
Once you've completed these steps, head back to http://localhost:3000/drinks—the error should be gone, and you'll be able to interact with your new model!
If you still hit snags, take a look at the terminal output when you run rails db:migrate—it might flag a specific issue (like a typo in your migration file) that you can tweak.
内容的提问来源于stack exchange,提问作者Emily Kief

