Rails 7.0 introduces a change that ensures conditions merged on the same column are not maintained, however, only the latter condition is retained.
Before Rails 7.0
Rails 6.1 (IN clause is replaced by merger side equality condition)
1
Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob]
Rails 6.1 (both conflict conditions exist, deprecated)
1
Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => []
Rails 6.1 with rewhere to migrate to Rails 7.0’s behavior
1
Author.where(id: david.id..mary.id).merge(Author.where(id: bob), rewhere: true) # => [bob]
After Rails 7.0
Rails 7.0 (same behavior with IN clause, merge side condition is consistently replaced)
1
2
Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob]
Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => [bob]