diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-10-15 18:45:26 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-10-15 18:45:26 -0300 |
commit | d01fa1be3148ba45de6135ba98b4bb369d58addd (patch) | |
tree | b7b01c3a88675da75d6f78afd6f4e19a164b635f /activerecord | |
parent | 1130b5d38904a19966508154023fca5df7eecaab (diff) | |
download | rails-d01fa1be3148ba45de6135ba98b4bb369d58addd.tar.gz rails-d01fa1be3148ba45de6135ba98b4bb369d58addd.tar.bz2 rails-d01fa1be3148ba45de6135ba98b4bb369d58addd.zip |
Use if/else instead of early raise
Diffstat (limited to 'activerecord')
-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? |