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?
on 2007-04-24 09:24
on 2007-04-24 10:02
Check out establish_connection: http://api.rubyonrails.org/classes/ActiveRecord/Ba... b
on 2007-04-24 10:07
On 4/24/07, Aryk Grosz <email@example.com> 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/HowtoUseMu..., and/or search this groups archives for "multiple databases". HTH, Isak