Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract local variable to avoid method call

  • Loading branch information...
commit cfbd4a493e747e0b97052f30319fb57e870069e5 1 parent 603d553
@rafaelfranca rafaelfranca authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/associations/preloader.rb
View
5 activerecord/lib/active_record/associations/preloader.rb
@@ -141,10 +141,11 @@ def grouped_records(association)
def records_by_reflection(association)
records.group_by do |record|
- reflection = record.class.reflections[association]
+ record_class = record.class
+ reflection = record_class.reflections[association]
unless reflection
- raise ActiveRecord::ConfigurationError, "Association named '#{association}' was not found on #{record.class.name}; " \
+ raise ActiveRecord::ConfigurationError, "Association named '#{association}' was not found on #{record_class.name}; " \
"perhaps you misspelled it?"
end
Please sign in to comment.
Something went wrong with that request. Please try again.