has_and_belongs_to_many: use JOIN instead of LEFT JOIN. References #2937.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3155 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2005-11-21 22:27:19 +00:00
parent f783d50cf8
commit d21ba5aec9
2 changed files with 4 additions and 2 deletions

@ -1,5 +1,7 @@
*SVN* *SVN*
* has_and_belongs_to_many: use JOIN instead of LEFT JOIN. [Jeremy Kemper]
* MySQL: introduce :encoding option to specify the character set for client, connection, and results. Only available for MySQL 4.1 and later with the mysql-ruby driver. Do SHOW CHARACTER SET in mysql client to see available encodings. #2975 [Shugo Maeda] * MySQL: introduce :encoding option to specify the character set for client, connection, and results. Only available for MySQL 4.1 and later with the mysql-ruby driver. Do SHOW CHARACTER SET in mysql client to see available encodings. #2975 [Shugo Maeda]
* Add tasks to create, drop and rebuild the MySQL and PostgreSQL test databases. [Marcel Molina Jr.] * Add tasks to create, drop and rebuild the MySQL and PostgreSQL test databases. [Marcel Molina Jr.]

@ -154,8 +154,8 @@ def construct_sql
@finder_sql = "#{@join_table}.#{@association_class_primary_key_name} = #{@owner.quoted_id} " @finder_sql = "#{@join_table}.#{@association_class_primary_key_name} = #{@owner.quoted_id} "
@finder_sql << " AND (#{interpolate_sql(@options[:conditions])})" if @options[:conditions] @finder_sql << " AND (#{interpolate_sql(@options[:conditions])})" if @options[:conditions]
end end
@join_sql = "LEFT JOIN #{@join_table} ON #{@association_class.table_name}.#{@association_class.primary_key} = #{@join_table}.#{@association_foreign_key}" @join_sql = "JOIN #{@join_table} ON #{@association_class.table_name}.#{@association_class.primary_key} = #{@join_table}.#{@association_foreign_key}"
end end
end end