RoR 4 - Connection to multiple databases

Hi there,

is it somehow possible to connect from a running Rails4-app to another

My problem is that I have to transfer records from a table from the main
database to a different database.

I just found a solution to connect to a seperate database.

i) You have to put another entry to your database.yml.
Let it be something like this here:

adapter: postgresql

ii) Create a new model with the same name of your secound database:
secound_database.rb :

class SecoundDatabase < ActiveRecord::Base
self.abstract_class = true

iii) Create another model, with the name of the table of your secound

class SomeTable < SecoundDatabase


That’s it guys!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs