instance method
structurally_compatible?
Ruby on Rails 7.0.10
Since v7.0.10Signature
structurally_compatible?(other)
Checks whether the given relation is structurally compatible with this relation, to determine if it’s possible to use the #and and #or methods without raising an error. Structurally compatible is defined as: they must be scoping the same model, and they must differ only by #where (if no #group has been defined) or #having (if a #group is present).
Post.where("id = 1").structurally_compatible?(Post.where("author_id = 3")) # => true Post.joins(:comments).structurally_compatible?(Post.where("id = 1")) # => false
Parameters
-
otherreq
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 849
def structurally_compatible?(other)
structurally_incompatible_values_for(other).empty?
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 849
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods