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.
Due to STI nature it is required. Otherwise undesired behavior is possible
in dev and test environments(where usually lazy loading is enabled).
The udesired behavior can be like:
Fetching not loaded yet STI model through its parent model
(e.g.
User.find(service_account_id)
raisesActiveRecord::NotFound
, becauseServiceAccount
has not been referenced yet.SubclassRegistry
has been removed, because:.register_subclasses
and.registered_subclasses
produce unexpected results.There seems to be no big win in have the additional list of subclasses that have to be manually filled.
Used in this PR approach seems to be simpler.
It is just calling STI classes explicitly in to_prepare block of configuration.