Remote database ActiveRecord model

Does anyone know how to make a model connect to a remote database and
only for that specific model?

That way I can do the typical CRUD functions on a remote server?

Check out establish_connection:

http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001075

b

On 4/24/07, Aryk G. [email protected] wrote:

Does anyone know how to make a model connect to a remote database and
only for that specific model?

That way I can do the typical CRUD functions on a remote server?

AFAIK distributed transactions with Ruby/Rails is an unsolved problem.
If neccessary, your best bet is probably talking to a Java or .net
-based backend over a web service, or perhaps having a look at JRuby;
which can probably work with JTA.

However, if you, like most rails/php/web/mysql programmers, don’t care
about or need data integrity, connecting one of your models to a
different db is fairly simple.

Start at
http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases,
and/or search this groups archives for “multiple databases”.

HTH,
Isak