Forum: Ruby on Rails multiple databases

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.
Raphael B. (Guest)
on 2005-12-19 23:03
(Received via mailing list)
Hi,

I'm writing a translation plugin which takes the translations from a
database that is different than the application's main database.
When in my plugin's models I put this code:

   ActiveRecord::Base.establish_connection(
    RAILS_ENV+"-translations"
  )

all my application's models use the plugin's database....
Why are my application's models not using the default database? The
plugin models are not related to the application's models.

Thanks.

Raph
Raphael B. (Guest)
on 2005-12-19 23:15
(Received via mailing list)
On 12/19/05, Raphael B. <removed_email_address@domain.invalid> wrote:
> all my application's models use the plugin's database....
> Why are my application's models not using the default database? The
> plugin models are not related to the application's models.


solution, use this code in the model:

establish_connection(
     RAILS_ENV+"-translations"
   )

sorry for the noise :|

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