Exception: ActiveRecord::HasManyThroughSourceAssociationNotFoundError

Inherits:
ActiveRecordError show all
Defined in:
activerecord/lib/active_record/associations.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(reflection) ⇒ HasManyThroughSourceAssociationNotFoundError



56
57
58
59
60
61
# File 'activerecord/lib/active_record/associations.rb', line 56

def initialize(reflection)
  through_reflection      = reflection.through_reflection
  source_reflection_names = reflection.source_reflection_names
  source_associations     = reflection.through_reflection.klass._reflections.keys
  super("Could not find the source association(s) #{source_reflection_names.collect(&:inspect).to_sentence(:two_words_connector => ' or ', :last_word_connector => ', or ', :locale => :en)} in model #{through_reflection.klass}. Try 'has_many #{reflection.name.inspect}, :through => #{through_reflection.name.inspect}, :source => <name>'. Is it one of #{source_associations.to_sentence(:two_words_connector => ' or ', :last_word_connector => ', or ', :locale => :en)}?")
end