aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSebastian Korfmann <korfmann.sebastian@gmail.com>2012-09-08 09:09:48 +1000
committerSebastian Korfmann <korfmann.sebastian@gmail.com>2012-09-10 08:50:46 +1000
commit1e554a6011c3603b509ac0d83bf81c866053bb49 (patch)
tree3a703eb21aa6ad826faf5c38393d41360fce30d0 /activerecord
parentf415475621c79cbc2d93e1ecf10805a4100a5d43 (diff)
downloadrails-1e554a6011c3603b509ac0d83bf81c866053bb49.tar.gz
rails-1e554a6011c3603b509ac0d83bf81c866053bb49.tar.bz2
rails-1e554a6011c3603b509ac0d83bf81c866053bb49.zip
Improve exception message for HasManyThroughAssociationPolymorphicSourceError
Exception message was misleading, as it is possible to have a polymorphic 'has_many :through' join model.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index d6b8552e6e..60b7118d7e 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -17,7 +17,7 @@ module ActiveRecord
class HasManyThroughAssociationPolymorphicSourceError < ActiveRecordError #:nodoc:
def initialize(owner_class_name, reflection, source_reflection)
- super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' on the polymorphic object '#{source_reflection.class_name}##{source_reflection.name}'.")
+ super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' on the polymorphic object '#{source_reflection.class_name}##{source_reflection.name}' without 'source_type'. Try adding 'source_type: \"#{reflection.name.to_s.classify}\"' to 'has_many :through' definition.")
end
end