mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix incorrect usage of #classify when creating the eager loading join statement. Closes #7044 [Josh Susser]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Fix incorrect usage of #classify when creating the eager loading join statement. Closes #7044 [Josh Susser]
|
||||
|
||||
* SQLServer: quote table name in indexes query. #2928 [keithm@infused.org]
|
||||
|
||||
* Subclasses of an abstract class work with single-table inheritance. #5704, #7284 [BertG, nick+rails@ag.arizona.edu]
|
||||
|
||||
@@ -1545,11 +1545,11 @@ module ActiveRecord
|
||||
" LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [
|
||||
table_alias_for(options[:join_table], aliased_join_table_name),
|
||||
aliased_join_table_name,
|
||||
options[:foreign_key] || reflection.active_record.to_s.classify.foreign_key,
|
||||
options[:foreign_key] || reflection.active_record.to_s.foreign_key,
|
||||
parent.aliased_table_name, reflection.active_record.primary_key] +
|
||||
" LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [
|
||||
table_name_and_alias, aliased_table_name, klass.primary_key,
|
||||
aliased_join_table_name, options[:association_foreign_key] || klass.table_name.classify.foreign_key
|
||||
aliased_join_table_name, options[:association_foreign_key] || klass.to_s.foreign_key
|
||||
]
|
||||
when :has_many, :has_one
|
||||
case
|
||||
@@ -1565,7 +1565,7 @@ module ActiveRecord
|
||||
parent.aliased_table_name, parent.primary_key,
|
||||
aliased_join_table_name, polymorphic_foreign_type, klass.quote_value(parent.active_record.base_class.name)] +
|
||||
" LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [table_name_and_alias,
|
||||
aliased_table_name, primary_key, aliased_join_table_name, options[:foreign_key] || reflection.klass.to_s.classify.foreign_key
|
||||
aliased_table_name, primary_key, aliased_join_table_name, options[:foreign_key] || reflection.klass.to_s.foreign_key
|
||||
]
|
||||
else
|
||||
if source_reflection.macro == :has_many && source_reflection.options[:as]
|
||||
@@ -1584,10 +1584,10 @@ module ActiveRecord
|
||||
case source_reflection.macro
|
||||
when :belongs_to
|
||||
first_key = primary_key
|
||||
second_key = source_reflection.options[:foreign_key] || klass.to_s.classify.foreign_key
|
||||
second_key = source_reflection.options[:foreign_key] || klass.to_s.foreign_key
|
||||
extra = nil
|
||||
when :has_many
|
||||
first_key = through_reflection.klass.base_class.to_s.classify.foreign_key
|
||||
first_key = through_reflection.klass.base_class.to_s.foreign_key
|
||||
second_key = options[:foreign_key] || primary_key
|
||||
extra = through_reflection.klass.descends_from_active_record? ? nil :
|
||||
" AND %s.%s = %s" % [
|
||||
|
||||
Reference in New Issue
Block a user