Getting AR to downcase table and column names

I’m looking for the cleanest way to force the Rails framework to use a
lower-case version of the table and column names in a database when
creating records.

I need this for a Rails application that displays the status of an
existing backup system. The backup system (Bacula; Nice backup
system, BTW) can use either Postgres or Mysql as its database engine.
Unfortunately, the table and column names are created in all lower
case when using Postgres, and in StudlyCaps when using Mysql. I’d
like my application to be able to work against either database type
without having to modify the capitalization of all the table and
column names in the application code.

The best approach that I’ve found so far is to conditionally override
the accessor methods, like so:

class Pool < ActiveRecord::Base
  Pool.table_name = 'pool'
  Pool.primary_key = 'poolid'

  if STUDLY
Pool.table_name = 'Pool'
def id; self.PoolId; end
def name; self.Name; end
def volretention; self.VolRetention; end
  end
end

While this works, it’s not very elegant. I’d much prefer some
application-wide “downcase field names” setting, but haven’t found any
way to force this behavior. Any hints would be greatly appreciated.

– John Kodis.