This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the rails category.
Last Updated: 2024-12-03
After running my deploy script (which migrates the DB and clears the cache, I got fatal errors on my homepage. When I tried running the code that was causing the errors in a freshly started production console process, it worked. This seems to indicate that the server had old code.
This adds up. The existing Rails server process only figures out the database structure at boot. Therefore it will be labouring until false assumptions until it rescans the database at start. Thus a restart is needed.
Always restart the Rails server after doing a database migration.