Skip to content
This repository
Browse code

Fixed non-standard SQL generated by preloading has_and_belongs_to_man…

…y association. [#394 state:resolved]
  • Loading branch information...
commit 4689496b525526a776004c4986d98b0ce62309d5 1 parent c83a183
Antonio Cangiano authored June 11, 2008 jeremy committed June 11, 2008
4  activerecord/lib/active_record/association_preload.rb
@@ -103,10 +103,10 @@ def preload_has_and_belongs_to_many_association(records, reflection, preload_opt
103 103
         associated_records = reflection.klass.find(:all, :conditions => [conditions, ids],
104 104
         :include => options[:include],
105 105
         :joins => "INNER JOIN #{connection.quote_table_name options[:join_table]} as t0 ON #{reflection.klass.quoted_table_name}.#{reflection.klass.primary_key} = t0.#{reflection.association_foreign_key}",
106  
-        :select => "#{options[:select] || table_name+'.*'}, t0.#{reflection.primary_key_name} as _parent_record_id",
  106
+        :select => "#{options[:select] || table_name+'.*'}, t0.#{reflection.primary_key_name} as the_parent_record_id",
107 107
         :order => options[:order])
108 108
 
109  
-        set_association_collection_records(id_to_record_map, reflection.name, associated_records, '_parent_record_id')
  109
+        set_association_collection_records(id_to_record_map, reflection.name, associated_records, 'the_parent_record_id')
110 110
       end
111 111
 
112 112
       def preload_has_one_association(records, reflection, preload_options={})

0 notes on commit 4689496

Please sign in to comment.
Something went wrong with that request. Please try again.