rails/rails — pull request #12308 by route (2013-09-21 12:24:54+00:00)
Title: Give `reset_scope` duties to reset also scope for `CollectionProxy`

Since `CollectionProxy` descendants from `Relation` and `bind_values` defined
right on `Relation` that when the `@owner` is saved it resets just association
scope but `CollectionProxy` is still the same and has wrong bind_values.
It worked properly before this commit c86a32d7451c5d901620ac58630460915292f88b
because was invoked right on `scoped`. And after this commit for a while because
`CollectionProxy` was recreated each time in association reader. But it got broken
since it cached in instance variable `@proxy` (it's correct behavior).

Attached test will produce this query on `update_all` if we remove fix:
`UPDATE "posts" SET "title" = 'Changed' WHERE "posts"."author_id" = ? [["author_id", nil]]`
but ought to add author_id.