From a26d4ad64b0451301711b7050dea2593c977cfd3 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 19 Jun 2016 10:14:06 +0900 Subject: [PATCH] `PolymorphicReflection` is not using the methods from `ThroughReflection` `ThroughReflection` initializes `@delegate_reflection` and delegate all public methods to `delegate_reflection`. But `PolymorphicReflection` does not initialize `@delegate_reflection`. It is enough to inherit `AbstractReflection` (using `alias_candidate` only). --- activerecord/lib/active_record/reflection.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index bf398b0d40..6684283f03 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -135,8 +135,8 @@ module ActiveRecord # BelongsToReflection # HasAndBelongsToManyReflection # ThroughReflection - # PolymorphicReflection - # RuntimeReflection + # PolymorphicReflection + # RuntimeReflection class AbstractReflection # :nodoc: def through_reflection? false @@ -981,7 +981,7 @@ module ActiveRecord end - class PolymorphicReflection < ThroughReflection # :nodoc: + class PolymorphicReflection < AbstractReflection # :nodoc: def initialize(reflection, previous_reflection) @reflection = reflection @previous_reflection = previous_reflection