fix: more flexible polymorphic types lookup#1424
Closed
Conversation
a140f14 to
7915c04
Compare
bf4
commented
Dec 31, 2023
| next unless Module === klass | ||
| if ActiveRecord::Base > klass | ||
| is_active_record_inspectable = ActiveRecord::Base > klass | ||
| is_active_record_inspectable &&= klass.respond_to?(:reflect_on_all_associations, true) |
Collaborator
Author
There was a problem hiding this comment.
@lgebhardt I'll add a test for this. I'm testing against our app on this branch right now and looks good
bf4
commented
Dec 31, 2023
| end | ||
| end | ||
| @poly_hash[_polymorphic_name.to_sym] | ||
| JSONAPI::Relationship.polymorphic_types(_polymorphic_name.to_sym) |
Collaborator
Author
There was a problem hiding this comment.
@lgebhardt is a refactor included in the PR as a separate commit
bf4
commented
Dec 31, 2023
| end | ||
| @poly_hash[name.to_sym] | ||
| @poly_hash.fetch(name.to_sym) do | ||
| klass = name.classify.safe_constantize |
Collaborator
Author
There was a problem hiding this comment.
fallback strategy I'm trying
7915c04 to
338303a
Compare
they pass on v-11-dev I'm going to look into the existing lookup warnings now ``` [POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for fileable [POLYMORPHIC TYPE] No polymorphic types found for FilePropertiesResource fileable [POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for respondent [POLYMORPHIC TYPE] No polymorphic types found for QuestionResource respondent [POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for respondent [POLYMORPHIC TYPE] No polymorphic types found for AnswerResource respondent [POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for keepable [POLYMORPHIC TYPE] No polymorphic types found for KeeperResource keepable ```
338303a to
cc46f11
Compare
12 tasks
Contributor
|
Supplanted by #1433 |
12 tasks
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.
Includes:
All Submissions:
New Feature Submissions:
Bug fixes and Changes to Core Features:
Test Plan:
Reviewer Checklist: