Efficient way of using multple Database

Is there a efficient way of using multiple databases in a Rails
application. I saw DB Charmer but, it did not work with 3.2.8 and even
in Rails 3.2.3 it gave problems.

On 29 August 2012 12:31, Karthikeyan A k [email protected] wrote:

Is there a efficient way of using multiple databases in a Rails
application. I saw DB Charmer but, it did not work with 3.2.8 and even
in Rails 3.2.3 it gave problems.

Is using establish_connection inefficient?

Colin

Nope, what I am thinking is we need to migrate, the two databases need
different set of tables. I am having a hard time.

On 29 August 2012 13:54, Karthikeyan A k [email protected] wrote:

Nope, what I am thinking is we need to migrate, the two databases need
different set of tables. I am having a hard time.

Ah, ok, a subject line and posting that asked for the best way to
handle migration of multiple databases might have been more useful.
Sorry I have never done that, but googling for
rails migrate multiple databases
yields some likely looking hits.

Colin

There is a gem called DB charmer, but does not work :frowning:

You can try the following, so far it has worked for me on rails 3.2.8

Grab the gem source code from

  1. git clone GitHub - kovyrin/db-charmer: ActiveRecord Connections Magic (slaves, multiple connections, sharding, etc)

Modify the dependency inside the gemspec file, instead of <= 3.2.3 edit
to ~> 3.2.3
2. vim db-charmer.gemspec
3. s.add_dependency ‘activesupport’, ‘~> 3.2.3’
s.add_dependency ‘activerecord’, ‘~> 3.2.3’

Build the Gem.

  1. gem build db-charmer.gemspec

Install the newly built gem. (You should replace the old one after with
gem clean)

  1. gem install db-charmer-1.7.1.gem

It seems like the Ruby Core team changed the internals of ActiveRecord
in 3.2.4 and beyond, so charmer stopped working.

-David

We use Octopus GitHub - thiagopradi/octopus: Database Sharding for ActiveRecord , its quiet good
enough