Rails 3.1 RC6 PG schema issue with cache_classes

I’ve got a PostgreSQL DB setup using schemas and I’m running into an issue when config.cache_classes = true (ie, in production mode only and not in development mode).

Attempting to start the console or webrick in production fails outright because the postgresql adapter can’t find my tables … they don’t exist in the default public schema and the search path is not set until a request comes in. This isn’t an issue under Rails 3.0. Here’s the topmost error -

/home/jgelo/.rvm/gems/ruby-1.9.3-preview1/gems/activerecord-3.1.0.rc6/lib/active_record/connection_adapters/postgresql_adapter.rb:962:in `async_exec’: PGError: ERROR: relation “entities” does not exist (ActiveRecord::StatementInvalid)

Just wanted to check if anyone has run into this or had any ideas before submitting a report.

Just a quick followup on this, I wasn’t able to reproduce the issue with a new 3.1 app and haven’t had a chance to track down the root cause … but some requires/dependencies are pulling in a bunch of my models during init. To get around the problem I created an empty stub schema and set schema_search_path in database.yml to it so the table info can always be accessed.