diff options
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index cff70511f5..22aa175ce2 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -821,8 +821,11 @@ module ActiveRecord end if through_reflection.polymorphic? - raise HasOneAssociationPolymorphicThroughError.new(active_record.name, self) if has_one? - raise HasManyThroughAssociationPolymorphicThroughError.new(active_record.name, self) + if has_one? + raise HasOneAssociationPolymorphicThroughError.new(active_record.name, self) + else + raise HasManyThroughAssociationPolymorphicThroughError.new(active_record.name, self) + end end if source_reflection.nil? |