diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 8c10ac641b..700a4bf89c 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -139,8 +139,10 @@ module ActiveRecord else super end + elsif @reflection.klass.scopes.include?(method) + @reflection.klass.scopes[method].call(self, *args) else - @reflection.klass.send(:with_scope, construct_scope) do + with_scope construct_scope do if block_given? @reflection.klass.send(method, *args) { |*block_args| yield(*block_args) } else |