Guard Function#alias visits for Rails 8.1 compatibility#3
Closed
lucasmenezesds wants to merge 1 commit into
Closed
Guard Function#alias visits for Rails 8.1 compatibility#3lucasmenezesds wants to merge 1 commit into
lucasmenezesds wants to merge 1 commit into
Conversation
Guard the `visit obj.alias` calls with `respond_to?(:alias)` to keep the visitor working on Rails 6/7/8.0 (where the attribute exists) and Rails 8.1+ (where it does not). Rails 8.1 removed `attr_accessor :alias` from `Arel::Nodes::Function` (and dropped `Arel::Visitors::DepthFirst` itself), so the bundled `MultiTenant::ArelVisitorsDepthFirst` fallback raised NoMethodError when traversing Exists/Avg/Max/Min/Sum/NamedFunction/Count during the tenant-rewrite pass.
Author
|
Closing this PR because I'm going to apply the same fix as a monkey-patch inside the project instead of carrying it over to the fork. The change's impact would be broader than necessary and could negatively affect downstream consumers. Keeping the patch local to where it's used is the safer, more contained option. |
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.
Guard the
visit obj.aliascalls withrespond_to?(:alias)to keep the visitor working on Rails 6/7/8.0 (where the attribute exists) and Rails 8.1+ (where it does not).Rails 8.1 removed
attr_accessor :aliasfromArel::Nodes::Function(and droppedArel::Visitors::DepthFirstitself), so the bundledMultiTenant::ArelVisitorsDepthFirstfallback raised NoMethodError when traversing Exists/Avg/Max/Min/Sum/NamedFunction/Count during the tenant-rewrite pass.