diff options
author | eileencodes <eileencodes@gmail.com> | 2015-03-18 08:04:21 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2015-03-18 08:13:54 -0400 |
commit | 4df806f95f8c64c8a1406aebf5f82807ff76c611 (patch) | |
tree | 9c4f0cc7aa8c89526026c97399de6d82d66ac3f1 /guides/source/active_record_callbacks.md | |
parent | cce5126eb28764cc6dee2a9f92e2edcec4715fbe (diff) | |
download | rails-4df806f95f8c64c8a1406aebf5f82807ff76c611.tar.gz rails-4df806f95f8c64c8a1406aebf5f82807ff76c611.tar.bz2 rails-4df806f95f8c64c8a1406aebf5f82807ff76c611.zip |
Improve test for leaky scope chain
This is a better test for 51660f0. It is testing that the SQL is the
same before and after the previously leaky scope is called. Before if
`hotel.drink_designers` was called first then `hotel.recipes` would
incorrectly get the scope applied. We want to be sure that the
polymorphic hm:t association is not leaking into or affecting the
SQL for the hm:t association on `Hotel`.
The reason I couldn't do this before was because there was an issue with
the SQL getting cached and wanted to resolve that later and then fix the
test to be better. Because of the caching, this test requires that
`Hotel.reflect_on_association(:recipes).clear_association_scope_cache`
be called after the first call to `hotel.recipes` to clear the
assocation scope chain and not interfere with the rest of the test.
Diffstat (limited to 'guides/source/active_record_callbacks.md')
0 files changed, 0 insertions, 0 deletions