mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Optimized the SQL used to generate has_and_belongs_to_many queries by listing the join table first #693 [yerejm]
|
||||
|
||||
* 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]
|
||||
|
||||
* Fixed that Active Record would throw Broken Pipe errors with FCGI when the MySQL connection timed out instead of reconnecting #428 [Nicholas Seckar]
|
||||
|
||||
@@ -147,7 +147,7 @@ module ActiveRecord
|
||||
def construct_sql
|
||||
interpolate_sql_options!(@options, :finder_sql, :delete_sql)
|
||||
@finder_sql = @options[:finder_sql] ||
|
||||
"SELECT t.*, j.* FROM #{@association_table_name} t, #{@join_table} j " +
|
||||
"SELECT t.*, j.* FROM #{@join_table} j, #{@association_table_name} t " +
|
||||
"WHERE t.#{@association_class.primary_key} = j.#{@association_foreign_key} AND " +
|
||||
"j.#{@association_class_primary_key_name} = #{@owner.quoted_id} " +
|
||||
(@options[:conditions] ? " AND " + interpolate_sql(@options[:conditions]) : "") + " " +
|
||||
|
||||
@@ -144,7 +144,7 @@ module ActiveRecord #:nodoc:
|
||||
# class Client < Company; end
|
||||
# class PriorityClient < Client; end
|
||||
#
|
||||
# When you do Firm.create("name" => "37signals"), this record with be saved in the companies table with type = "Firm". You can then
|
||||
# When you do Firm.create("name" => "37signals"), this record will be saved in the companies table with type = "Firm". You can then
|
||||
# fetch this row again using Company.find_first "name = '37signals'" and it will return a Firm object.
|
||||
#
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user