From d01fa1be3148ba45de6135ba98b4bb369d58addd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 15 Oct 2014 18:45:26 -0300 Subject: Use if/else instead of early raise --- activerecord/lib/active_record/reflection.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'activerecord') 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? -- cgit v1.2.3