From aa86420be24d7df9c07379bcf6f33904d0d41adc Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Mon, 24 Jan 2011 20:57:11 +0000 Subject: Rename AssociationProxy#loaded to loaded! as it mutates the association --- activerecord/lib/active_record/association_preload.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/association_preload.rb') diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb index cba4bab3ef..b83c00e9f8 100644 --- a/activerecord/lib/active_record/association_preload.rb +++ b/activerecord/lib/active_record/association_preload.rb @@ -125,7 +125,7 @@ module ActiveRecord def add_preloaded_records_to_collection(parent_records, reflection_name, associated_record) parent_records.each do |parent_record| association_proxy = parent_record.send(reflection_name) - association_proxy.loaded + association_proxy.loaded! association_proxy.target.concat(Array.wrap(associated_record)) association_proxy.send(:set_inverse_instance, associated_record) end @@ -187,7 +187,7 @@ module ActiveRecord id_to_record_map = construct_id_map(records) - records.each {|record| record.send(reflection.name).loaded} + records.each { |record| record.send(reflection.name).loaded! } options = reflection.options right = Arel::Table.new(options[:join_table]).alias('t0') @@ -268,7 +268,7 @@ module ActiveRecord foreign_key = reflection.through_reflection_foreign_key id_to_record_map = construct_id_map(records, foreign_key || reflection.options[:primary_key]) - records.each {|record| record.send(reflection.name).loaded} + records.each { |record| record.send(reflection.name).loaded! } if options[:through] through_records = preload_through_records(records, reflection, options[:through]) -- cgit v1.2.3