aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-10-15 18:45:26 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-10-15 18:45:26 -0300
commitd01fa1be3148ba45de6135ba98b4bb369d58addd (patch)
treeb7b01c3a88675da75d6f78afd6f4e19a164b635f /activerecord/lib/active_record
parent1130b5d38904a19966508154023fca5df7eecaab (diff)
downloadrails-d01fa1be3148ba45de6135ba98b4bb369d58addd.tar.gz
rails-d01fa1be3148ba45de6135ba98b4bb369d58addd.tar.bz2
rails-d01fa1be3148ba45de6135ba98b4bb369d58addd.zip
Use if/else instead of early raise
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/reflection.rb7
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?