Skip to content

Commit

Permalink
Allow or in case of from clause with same value
Browse files Browse the repository at this point in the history
  • Loading branch information
sinsoku committed Jan 4, 2020
1 parent aca85f6 commit 8d58bdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions activerecord/lib/active_record/relation/from_clause.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def empty?
value.nil?
end

def ==(other)
other.is_a?(FromClause) && name == other.name && value == other.value
end

def self.empty
@empty ||= new(nil, nil).freeze
end
Expand Down
1 change: 1 addition & 0 deletions activerecord/test/cases/relation/or_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def test_structurally_incompatible_values
Post.group(:author_id).group(:author_id).or(Post.group(:author_id))
Post.joins(:author).joins(:author).or(Post.joins(:author))
Post.left_outer_joins(:author).left_outer_joins(:author).or(Post.left_outer_joins(:author))
Post.from("posts").or(Post.from("posts"))
end
end
end
Expand Down

0 comments on commit 8d58bdd

Please sign in to comment.