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.
Andy (Guest)
on 2006-01-21 17: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
Andy (Guest)
on 2006-01-21 17:28
so for example i might have table SAL.customers and table
SALDATA.accounts.  How do i tell active record which table to use?
Michael Schoen (Guest)
on 2006-01-23 07: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.