diff options
author | Antonio Cangiano <acangiano@gmail.com> | 2008-06-11 15:25:19 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-11 17:25:39 -0700 |
commit | e170d34a634c93efef471f9c0c1dac7377f1fc40 (patch) | |
tree | eb5d9566044aa3600c1dbee9c61019a702a3f933 | |
parent | e6c1f46eb0fe637195bdf95647dd3aee72467580 (diff) | |
download | rails-e170d34a634c93efef471f9c0c1dac7377f1fc40.tar.gz rails-e170d34a634c93efef471f9c0c1dac7377f1fc40.tar.bz2 rails-e170d34a634c93efef471f9c0c1dac7377f1fc40.zip |
Fixed non-standard SQL generated by preloading has_and_belongs_to_many association
-rw-r--r-- | activerecord/lib/active_record/association_preload.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb index a3d1f12b03..49f5270396 100644 --- a/activerecord/lib/active_record/association_preload.rb +++ b/activerecord/lib/active_record/association_preload.rb @@ -103,10 +103,10 @@ module ActiveRecord associated_records = reflection.klass.find(:all, :conditions => [conditions, ids], :include => options[:include], :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}", - :select => "#{options[:select] || table_name+'.*'}, t0.#{reflection.primary_key_name} as _parent_record_id", + :select => "#{options[:select] || table_name+'.*'}, t0.#{reflection.primary_key_name} as the_parent_record_id", :order => options[:order]) - set_association_collection_records(id_to_record_map, reflection.name, associated_records, '_parent_record_id') + set_association_collection_records(id_to_record_map, reflection.name, associated_records, 'the_parent_record_id') end def preload_has_one_association(records, reflection, preload_options={}) |