Re: Changing a model''s database connection

Marnen Laibow-Koser
Mon, 19 Jul 2010 18:14:55 -0000

Michaël wrote:
> Hi,
>
> I''ve got a simple problem. I''ve got a collection of
models, Customer,
> Product and Shop, and they''re all using the database configured
for
> the ActiveRecord class. However, for one particular task -- generating
> a report -- I want to be able to set those models to use a database on
> a different server. The secondary database is simply a copy of the
> first, so the schemas and data is identical to the main database, but
> I want to use this secondary server so that the load of producing
> reports doesn''t affect the main database server.

I think you would be better advised to use your DB server''s
clustering/load-balancing features for this.  It should not be your
application''s concern.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org
--
Posted via http://www.ruby-forum.com/.