Exception: ActiveRecord::HasManyThroughSourceAssociationNotFoundError
- Inherits:
-
ActiveRecordError
- Object
- StandardError
- ActiveRecordError
- ActiveRecord::HasManyThroughSourceAssociationNotFoundError
- Defined in:
- lib/active_record/associations.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(reflection = nil) ⇒ HasManyThroughSourceAssociationNotFoundError
constructor
A new instance of HasManyThroughSourceAssociationNotFoundError.
Constructor Details
#initialize(reflection = nil) ⇒ HasManyThroughSourceAssociationNotFoundError
Returns a new instance of HasManyThroughSourceAssociationNotFoundError.
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_record/associations.rb', line 90 def initialize(reflection = nil) if 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 ')} 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 ')}?") else super("Could not find the source association(s).") end end |