diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-22 09:26:18 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-22 11:06:19 +0900 |
commit | 22fa48f2fc1c4d71d42eaed41ea1ef9af618d585 (patch) | |
tree | 2abede43d718842768961880bc1a97dbc83f2f92 /activerecord/lib/active_record/relation/delegation.rb | |
parent | 0541a0d5481043a9c78371446389794944daf3f0 (diff) | |
download | rails-22fa48f2fc1c4d71d42eaed41ea1ef9af618d585.tar.gz rails-22fa48f2fc1c4d71d42eaed41ea1ef9af618d585.tar.bz2 rails-22fa48f2fc1c4d71d42eaed41ea1ef9af618d585.zip |
Mixin `CollectionProxy::DelegateExtending` after `ClassSpecificRelation`
`ClassSpecificRelation` has `method_missing` and the `method_missing` is
called first. if an associated class has the missing method in a
relation, never reach to the `method_missing` in the `CollectionProxy`.
I extracted `DelegateExtending` and included it to the delegate class
that including `ClassSpecificRelation` to fix the issue.
Fixes https://github.com/rails/rails/pull/28246#issuecomment-296033784.
Diffstat (limited to 'activerecord/lib/active_record/relation/delegation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/delegation.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 50378f9d99..1bf552b937 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -25,6 +25,8 @@ module ActiveRecord def inherited(child_class) child_class.initialize_relation_delegate_cache + delegate = child_class.relation_delegate_class(ActiveRecord::Associations::CollectionProxy) + delegate.include ActiveRecord::Associations::CollectionProxy::DelegateExtending super end end |