Removing columns from tables when starting an application using ActiveRecord causes errors because ActiveRecord caches column names.
A workaround for other versions of ActiveRecord is to override the #columns method in the model and filter out the obsolete column names before migration (basically, hide these columns from AR). This worked because all the methods associated with the column name were based on calling #columns
In ActiveRecord 3.1, table structure caching is moved to ConnectionPool, and all values โโassociated with the column name (e.g. coluumns_hash) are cached independently (3.2 uses ModelSchema.columns, which make it work again)
Is there a way (other than deeply cracking concrete adapters) to achieve a safe column fall in ActiveRecord 3.1?
Unclegene
source share