Forum: Ruby on Rails Specifying which Oracle schema to use with ActiveRecord

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cd8c9864d88bcafc164d8fdb820cc451?d=identicon&s=25 Andy (Guest)
on 2006-01-21 16:04
We use Oracle in my company.

I have access to 2 schemas (or tablespaces?) :

1.SAL
2.SALDATA

I use tables from both schemas.  How do i tell active record which
schema to look in for the table i
want???

I've just managed to convince the boss to switch from Java to Rails so
this would be a arse if i couldnt use both schemas.

Any help would be GREATELY appreciated!

Thanks,
Chris
Cd8c9864d88bcafc164d8fdb820cc451?d=identicon&s=25 Andy (Guest)
on 2006-01-21 16:28
so for example i might have table SAL.customers and table
SALDATA.accounts.  How do i tell active record which table to use?
E75cda3e915fa209386fae3de962cb6a?d=identicon&s=25 Michael Schoen (Guest)
on 2006-01-23 06:34
(Received via mailing list)
Andy wrote:
> so for example i might have table SAL.customers and table
> SALDATA.accounts.  How do i tell active record which table to use?

Use #set_table_name (or #table_name=) and include the schema name. So,
something like:

class Account < ActiveRecord::Base
   set_table_name "saldata.accounts"

   ...

end
This topic is locked and can not be replied to.