public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Optimized the SQL used to generate has_and_belongs_to_many queries by 
listing the join table first #693 [yerejm]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@741 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Tue Feb 22 05:58:22 -0800 2005
commit  e9426d22646eed19627784ca07adc902f6c5fe9e
tree    a6ef6d10f0f92596d54749750ce4333f9de24057
parent  dfd43d577eaaf4b9c157f6379045d1e2fb68d1ee
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Optimized the SQL used to generate has_and_belongs_to_many queries by listing the join table first #693 [yerejm]
0
+
0
 * Fixed that when using validation macros with a custom message, if you happened to use single quotes in the message string you would get a parsing error #657 [tonka]
0
 
0
 * Fixed that Active Record would throw Broken Pipe errors with FCGI when the MySQL connection timed out instead of reconnecting #428 [Nicholas Seckar]
...
147
148
149
150
 
151
152
153
...
147
148
149
 
150
151
152
153
0
@@ -147,7 +147,7 @@
0
         def construct_sql
0
           interpolate_sql_options!(@options, :finder_sql, :delete_sql)
0
           @finder_sql = @options[:finder_sql] ||
0
- "SELECT t.*, j.* FROM #{@association_table_name} t, #{@join_table} j " +
0
+ "SELECT t.*, j.* FROM #{@join_table} j, #{@association_table_name} t " +
0
                 "WHERE t.#{@association_class.primary_key} = j.#{@association_foreign_key} AND " +
0
                 "j.#{@association_class_primary_key_name} = #{@owner.quoted_id} " +
0
                 (@options[:conditions] ? " AND " + interpolate_sql(@options[:conditions]) : "") + " " +
...
144
145
146
147
 
148
149
150
...
144
145
146
 
147
148
149
150
0
@@ -144,7 +144,7 @@
0
   # class Client < Company; end
0
   # class PriorityClient < Client; end
0
   #
0
- # When you do Firm.create("name" => "37signals"), this record with be saved in the companies table with type = "Firm". You can then
0
+ # When you do Firm.create("name" => "37signals"), this record will be saved in the companies table with type = "Firm". You can then
0
   # fetch this row again using Company.find_first "name = '37signals'" and it will return a Firm object.
0
   #
0
   # If you don't have a type column defined in your table, single-table inheritance won't be triggered. In that case, it'll work just

Comments

    No one has commented yet.