use translation model's connection pool#677
Open
ollym wants to merge 3 commits intoshioyama:masterfrom
Open
Conversation
Author
|
@shioyama any chance of getting this merged? This fixes how it works with Rails' multiple databases. Rails internally adopts the same mechanism for habtm tables here: https://github.com/rails/rails/blob/main/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb#L45-L47 Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For situations where you might want to leverage Rails' multiple databases, eg.
Currently if you do this:
The word record is fetched using the reading role, but the translation is fetched using the writing role because the Translation class inherits from it's own abstract class.
This PR introduces some logic that will use by default the abstract class of the model that it is translating, and therefore reuse its connection properties.