Permalink
Browse files

Merge pull request #12511 from jetthoughts/informative_raise_message_…

…for_incorrect_association

Make missed association exception message more informative
Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/associations/preloader.rb
  • Loading branch information...
1 parent aa1e95e commit 603d5534e5282fa2da72accf90f7a2c1bf0c4bfd @rafaelfranca rafaelfranca committed Oct 13, 2013
Showing with 7 additions and 1 deletion.
  1. +6 −0 activerecord/CHANGELOG.md
  2. +1 −1 activerecord/lib/active_record/associations/preloader.rb
@@ -1,5 +1,11 @@
## unreleased ##
+* For missed association exception message
+ which is raised in `ActiveRecord::Associations::Preloader` class
+ added owner record class name in order to simplify to find problem code.
+
+ *Paul Nikitochkin*
+
* Fixes bug when using includes combined with select, the select statement was overwritten.
Fixes #11773.
@@ -144,7 +144,7 @@ def records_by_reflection(association)
reflection = record.class.reflections[association]
unless reflection
- raise ActiveRecord::ConfigurationError, "Association named '#{association}' was not found; " \
+ raise ActiveRecord::ConfigurationError, "Association named '#{association}' was not found on #{record.class.name}; " \
"perhaps you misspelled it?"
end

0 comments on commit 603d553

Please sign in to comment.