Scope config option to isolate translations #140
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.
In my usage of this gem, I ran into a situation where I'd like two very related applications that are organizationally distinct but part of the same domain (e.g. public web application and its admin/management application) to connect to the same database.
However, I'd like them not to share translation data, and found that difficult to do without overriding methods in
I18n::Backend::ActiveRecord
. So instead, I added this feature to my fork, and wanted to see what you think about it and whether you'd be interested in having it in the main codebase.Essentially I added a
scope
field to the migration and if the configuration option is set, then all reads/writes will be limited to only those records with that particular scope identifier. I wanted to maintain compatibility with existing tables that don't have a scope, or even newly created tables where someone wants to remove the scope field from the migration if they won't be using it.I've added two tests showing how I think the behaviour should work and a readme paragraph. Thanks taking the time to look this over☺️