Permalink
Browse files

Disable identity map when loading associated records from habtm.

  • Loading branch information...
1 parent dd6e680 commit fa11c60b4450394b2f4c048c5379bc9487f477c2 @miloops miloops committed Sep 13, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 activerecord/lib/active_record/association_preload.rb
@@ -199,8 +199,10 @@ def preload_has_and_belongs_to_many_association(records, reflection, preload_opt
select("#{options[:select] || table_name+'.*'}, t0.#{reflection.primary_key_name} as the_parent_record_id").
order(options[:order])
- all_associated_records = associated_records(ids) do |some_ids|
- associated_records_proxy.where([conditions, ids]).to_a
+ all_associated_records = ActiveRecord::IdentityMap.without do
+ associated_records(ids) do |some_ids|
+ associated_records_proxy.where([conditions, ids]).to_a
+ end
end
set_association_collection_records(id_to_record_map, reflection.name, all_associated_records, 'the_parent_record_id')

0 comments on commit fa11c60

Please sign in to comment.