mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
c8d889905d
This caused a bug with the new associations implementation, because now association conditions are represented as Arel nodes internally right up to when the whole thing gets turned to SQL. In Rails 3.2, association conditions get turned to raw SQL early on, which prevents Relation#merge from interfering. The current implementation was buggy when a default_scope existed on the target model, since we would basically end up doing: default_scope.merge(association_scope) If default_scope contained a where(foo: 'a') and association_scope contained a where(foo: 'b').where(foo: 'c') then the merger would see that the same column is representated on both sides of the merge and collapse the wheres to all but the last: where(foo: 'c') Now, the RHS of the merge is left alone. Fixes #8990
11 lines
148 B
YAML
11 lines
148 B
YAML
michael_welcome:
|
|
id: 1
|
|
post_id: 1
|
|
person_id: 1
|
|
first_post_id: 2
|
|
|
|
michael_authorless:
|
|
id: 2
|
|
post_id: 3
|
|
person_id: 1
|
|
first_post_id: 3
|