A "not so easy" way to solve this is to write your own database adapter, that would send the real SQL code to many different databases (your adapter would contain an array of other adapters that would receive the real SQL). That's how tools like C-JDBC do it.
But if you need this for MySQL only, you should try to use the database replication mechanism. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Tue, Jan 13, 2009 at 6:51 PM, Davi Vidal <[email protected]> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Jack Christensen wrote: >> Yanni Mac wrote: >>> I have an application that is load balanced. I have a master database >>> which I update once a day. Then I push the raw mysql files to all other >>> servers so they are the same as the master. This works fine, but there >>> are a few situations where I need all databases to update in real-time. >>> What would be the best way to achieve this in rails? >>> >>> Here is an example of what I am trying to do. I want to update the name >>> of a product on my website. Here is the controller: >>> >>> def update_product_name >>> product = Product.find(params[:id]) >>> product.name = params[:name] >>> product.save >>> #Say I want to save this to 3 other databases >>> #can I do this with activerecord? >>> #PSUEDO CODE... I know it cant do this >>> product.save(mysql_host2) >>> product.save(mysql_host3) >>> product.save(mysql_host4) >>> end >>> >>> Any ideas? Alternative ways to do this? >>> >> You could use MySQL's built-in replication support. >> > > > What if I want it on other SQL server? > > davi > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkltDOUACgkQ76Bs0E5RGKO3twCePRLi1tyfJM1FTGgQX3jiT7Co > BDgAnilihvAKaFQE+17ifR4RaASgLqjV > =a/a+ > -----END PGP SIGNATURE----- > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

