Clearing ActiveRecord cache
To a first approximation:
ActiveRecord::Base.connection.query_cache.clear
We use:
ActiveRecord::Base.connection.query_cache.clear
(ActiveRecord::Base.connection.tables - %w[schema_migrations versions]).each do |table|
table.classify.constantize.reset_column_information rescue nil
end
But I am not certain even this is enough.
Have a look at the method clear_query_cache
in http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/QueryCache.html