Skip to content

Commit

Permalink
Merge pull request rails#7569 from skorfmann/improve-has-many-through…
Browse files Browse the repository at this point in the history
…-exception-message

Improve exception message for HasManyThroughAssociationPolymorphicSourceError
  • Loading branch information
carlosantoniodasilva committed Sep 11, 2012
2 parents db17046 + 1e554a6 commit 8295663
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/associations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8295663

Please sign in to comment.