Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Reverted Bug #2362 has many through eager loading

  • Loading branch information...
commit 01179ab42c2d41df389ef4449b3a79729951b567 1 parent 09b0abd
@guimello guimello authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 activerecord/lib/active_record/association_preload.rb
View
9 activerecord/lib/active_record/association_preload.rb
@@ -282,11 +282,10 @@ def preload_through_records(records, reflection, through_association)
end
through_records.flatten!
else
- options = {}
- options[:include] = reflection.options[:include] || reflection.options[:source] if reflection.options[:conditions] || reflection.options[:order]
- options[:order] = reflection.options[:order]
- options[:conditions] = reflection.options[:conditions]
- records.first.class.preload_associations(records, through_association, options)
+ # Bug fix
+ # Reverting https://rails.lighthouseapp.com/projects/8994/tickets/2362-has-many-through-eager-loading-problem
+ # As it causes exception with has_many through
+ records.first.class.preload_associations(records, through_association)
through_records = records.map {|record| record.send(through_association)}.flatten
end
through_records.compact!
Please sign in to comment.
Something went wrong with that request. Please try again.