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

Fix associations with per-class/multiple database connections #3732

Closed

Conversation

larskanis
Copy link
Contributor

Current ActiveRecord does not work with per class database connections. It worked with 2.x and 3.0 series.

Here is a simple example, running against the ActiveRecord test database: https://gist.github.com/1388725
It throws ActiveRecord::ConnectionNotEstablished in line 16 without this patch.

The patch applies cleanly to 3-1-stable and master. I verified, that all ActiveRecord tests pass on SQLite and PostgreSQL.

@larskanis
Copy link
Contributor Author

Is there something I can do, so that someone pays attention to this patch? May I add a test case?

@rickmzp
Copy link

rickmzp commented Feb 7, 2012

+1 on this issue, but the patch needs test cases and it seems like you have a merge commit in there you shouldn't have

@larskanis
Copy link
Contributor Author

Thanks for responding! I'll try to create a test case for it. In a first try, it turned out to be a bit difficult, because ActiveRecord::Base.connection is always established, so that the wrong connection is used for the assotiations, but no error is raised. Maybe I'll have to look a bit deeper into the test suite.

@rickmzp
Copy link

rickmzp commented Feb 8, 2012

cool, thanks for the info! I'm actually going to give it a shot myself now. it's a bit of a blocker for me with how I'm using AR at the moment. I'll let you know how far I get.

@rickmzp
Copy link

rickmzp commented Feb 8, 2012

Check it out, larskanis: #4953

@larskanis
Copy link
Contributor Author

It's merged with #5000.

@larskanis larskanis closed this Feb 15, 2012
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

Successfully merging this pull request may close these issues.

None yet

2 participants