Today I Learned

A Hashrocket project

Rails 5 saves environment in the DB

Rails 5 added an internal metadata table that saves the rails environment to the database.

This metadata table can lead to an ActiveRecord::EnvironmentMismatchError when restoring a staging/production database to the development environment.

To fix the error, you can run rails db:environment:set

Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket and we'd love to take a look at your project. Contact us and find out how we can help you.