diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-02-11 13:40:28 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-02-11 13:46:30 -0700 |
commit | 5e0b555b453ea2ca36986c111512627d806101e7 (patch) | |
tree | 20db60dde260daf1bbc85cf00c8c5de7bf50bb7b /activerecord/CHANGELOG.md | |
parent | 42d62de0007b4b4813adc2eb27c3a83e57018ac4 (diff) | |
download | rails-5e0b555b453ea2ca36986c111512627d806101e7.tar.gz rails-5e0b555b453ea2ca36986c111512627d806101e7.tar.bz2 rails-5e0b555b453ea2ca36986c111512627d806101e7.zip |
`current_scope` shouldn't pollute sibling STI classes
It looks like the only reason `current_scope` was thread local on
`base_class` instead of `self` is to ensure that when we call a named
scope created with a proc on the parent class, it correctly uses the
default scope of the subclass. The reason this wasn't happening was
because the proc captured `self` as the parent class, and we're not
actually defining a real method. Using `instance_exec` fixes the
problem.
Fixes #18806
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 064c9008e0..0265ab0c11 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,14 @@ +* `scoping` no longer pollutes the current scope of sibling classes when using + STI. e.x. + + StiOne.none.scoping do + StiTwo.all + end + + Fixes #18806. + + *Sean Griffin* + * `remove_reference` with `foreign_key: true` removes the foreign key before removing the column. This fixes a bug where it was not possible to remove the column on MySQL. |