Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multiple databases #65

Closed
kshahkshah opened this issue Dec 3, 2014 · 2 comments
Closed

support multiple databases #65

kshahkshah opened this issue Dec 3, 2014 · 2 comments

Comments

@kshahkshah
Copy link

I am starting to use Makara - I am having no issues connecting to my pg master / dual pg slave on my main app's database.

However, we, like many other apps out there rely on multiple databases, our app servers from our main database and our workers consume data from a vendor database using establish_connection on AR models as such:

class VendorDataModel < ActiveRecord::Base
  establish_connection "#{Rails.env}_vendor_data"
end

It looks like this call no longer has any effect (Rails 4.1.8)

VendorDataModel.establish_connection
VendorDataModel.first # will result in an error, no such relation...

I'm about to dive into the code, but perhaps someone can let me know - is this supported and undocumented, if it isn't supported would you accept a patch?

Manually running:

connection = ActiveRecord::Base.establish_connection(...YAML...)[Rails.env]

Appears to work fine however.

Can anyone provide some insight?

@kshahkshah
Copy link
Author

Nope!! This was entirely my error. Insight is I need to be more careful

@MatTarantini
Copy link

What ended up being the solution here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants