Skip to content

How to connect to a separate db? #382

@shawn-zhuxy

Description

@shawn-zhuxy

Hi all;

I have found a same question in gitter but it did not be answered. So I have to ask again here.

I have a rails application that makes a connection to the different databases.
The model is like this:

# Bar Service
class Billing
   connects_to database: { writing: :foo_service, reading: :foo_service}
   has_closure_tree
end

Fetching records in Bar Service works fine. However, when I try to create an object it fails with: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "billing_hierarchies" does not exist.

I create billing_hierarchies in foo service, and I do not hope to create billing_hierarchies in bar service.
So is it a clean way to connect the closure tree to a separate db?

Thank you.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions