Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve exception message for HasManyThroughAssociationPolymorphicSou…

…rceError

Exception message was misleading, as it is possible to have a
polymorphic 'has_many :through' join model.
  • Loading branch information...
commit 1e554a6011c3603b509ac0d83bf81c866053bb49 1 parent f415475
@skorfmann skorfmann authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activerecord/lib/active_record/associations.rb
View
2  activerecord/lib/active_record/associations.rb
@@ -17,7 +17,7 @@ def initialize(owner_class_name, reflection)
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
Please sign in to comment.
Something went wrong with that request. Please try again.