diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-16 12:10:37 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-28 01:18:13 +0900 |
commit | 9b78974bc9f0dad0242d057b69f543471af2b92d (patch) | |
tree | fbc3922b2f0e6c708635e94fa9c449c09e6f03f1 /activerecord/test/cases/associations/extension_test.rb | |
parent | fcc47bcfccc7578aa0414710eecdad006085a911 (diff) | |
download | rails-9b78974bc9f0dad0242d057b69f543471af2b92d.tar.gz rails-9b78974bc9f0dad0242d057b69f543471af2b92d.tar.bz2 rails-9b78974bc9f0dad0242d057b69f543471af2b92d.zip |
Fix association with extension issues
This fixes the following issues.
* `association_scope` doesn't include `default_scope`. Should use `scope` instead.
* We can't use `method_missing` for customizing existing method.
* We can't use `relation_delegate_class` for sharing extensions. Should extend per association.
Diffstat (limited to 'activerecord/test/cases/associations/extension_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/extension_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/extension_test.rb b/activerecord/test/cases/associations/extension_test.rb index 87d842f21d..f707a170f5 100644 --- a/activerecord/test/cases/associations/extension_test.rb +++ b/activerecord/test/cases/associations/extension_test.rb @@ -78,6 +78,12 @@ class AssociationsExtensionsTest < ActiveRecord::TestCase assert_equal post.association(:comments), post.comments.where("1=1").the_association end + def test_association_with_default_scope + assert_raises OopsError do + posts(:welcome).comments.destroy_all + end + end + private def extend!(model) |