diff --git a/README.md b/README.md index b2d419f..d7fbc6c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1460 TILs and counting..._ +_1461 TILs and counting..._ --- @@ -990,6 +990,7 @@ _1460 TILs and counting..._ - [Skip Validations When Creating A Record](rails/skip-validations-when-creating-a-record.md) - [Specify New Attributes For #find_or_create_by](rails/specify-new-attributes-for-find-or-create-by.md) - [Temporarily Disable strong_params](rails/temporarily-disable-strong-params.md) +- [Temporarily Turn Off Pending Migrations Error](rails/temporarily-turn-off-pending-migrations-error.md) - [Test For A Subset Of Attributes On A Model](rails/test-for-a-subset-of-attributes-on-a-model.md) - [Test If An Instance Variable Was Assigned](rails/test-if-an-instance-variable-was-assigned.md) - [Test If deliver_later Is Called For A Mailer](rails/test-if-deliver-later-is-called-for-a-mailer.md) diff --git a/rails/temporarily-turn-off-pending-migrations-error.md b/rails/temporarily-turn-off-pending-migrations-error.md new file mode 100644 index 0000000..e4630c2 --- /dev/null +++ b/rails/temporarily-turn-off-pending-migrations-error.md @@ -0,0 +1,33 @@ +# Temporarily Turn Off Pending Migrations Error + +Whenever I'm working on an end-to-end feature in a Rails app, soon or later I +am going to see the _Pending Migrations_ error page. I try to visit one of the +routes in the browser and the Rails app serves this error page instead of my +actual request response. + +This is typically what I want. If there are migrations just sitting there that +haven't been run yet, that's probably an issue. Maybe I just pulled down the +latest changes from my teammates. The app isn't going to work properly without +whatever schema changes are prescribed in those pending migrations. + +The thing to do is run those migrations. + +In some special cases though, I know what I'm doing and I would like to operate +my app locally with specific migrations not yet applied. + +To skip the error, I can change this `config/environments/development.rb` +setting from: + +```ruby +config.active_record.migration_error = :page_load +``` + +to: + +```ruby +config.active_record.migration_error = false +``` + +I just need to make sure to switch it back when I'm done. + +[source](https://til.hashrocket.com/posts/ujcixh5rwi-rails-ignore-pending-migrations)