You can define different databases in your database.yml.
first:
adapter: mysql
database: first_development
username: user
password: pwd
host: localhost
second:
adapter: mysql
database: second_development
username: user
password: pwd
host: localhost
and then connect your models to different databases using ActiveRecord::Base.establish_connection
class A < ActiveRecord::Base
ActiveRecord::Base.establish_connection "first"
end
class B < ActiveRecord::Base
ActiveRecord::Base.establish_connection "second"
def self.sync
A.all.each do |record|
B.create(:email => record.email)
end
end
end
I added a simple method called sync that can be a starting point for your synchronisation issue,