rails/rails — Issue #3335: ConnectionPool cache not cleared automatically
Author: assembler
Created: 2011-10-15 09:10:48+00:00
State: open

I don't know whether this is rails, pg or even heroku bug.. so I'm not sure where to post this.
What I do know is that it started when i upgraded from rails 3.1 to rails 3.1.1.

Whenever I change my database schema through migrations, deploy it to the heroku bamboo stack,
run migrations remotely, my application crashes. It complains about "missing attribute" for specific model.

I did some research through code base and found out that I can fix the problem by opening heroku console and running following command:
ActiveRecord::Base.connection_pool.clear_cache!

My table has around 50 columns.

It works fine on my local machine in development mode.
Problem only appears when app is deployed.