Fully qualified table names in ActiveRecord

Hi there,

I’m developing an app based on a legacy database in which all the
tables were created by a user other than dbo. That means in order to
access the tables I need to qualify the table name with the owner
name, like so

“SELECT table.* from owner.table”

The problem is if I use ‘set_table_name “owner.table”’ then the sql
generated is incorrect

‘SELECT “owner.table”.* from “owner.table”’

Is there anyway to handle this elegantly with AR? I guess my choices

  1. Have my app access the DB as the user who created all the tables
    (super powerful user, so this is not really appealing)
  2. Modify the DB to have a group own all the tables, then throw my
    app user and the original user into the group (scary making those
    kinds of sweeping changes to a legacy DB that is at the heart of a
    business and already has several apps using it)
  3. Modify my code to use find_by_sql’s everywhere (just yuck)

I was thinking of trying to monkey patch the AR code to use different
values for the table name depending on if it is being used to identify
a column or a table, but that seems like an awful lot of work.

Are there any other suggestions out there?