mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4066 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table [Rick]
|
||||
|
||||
* Add support for :include to with_scope [andrew@redlinesoftware.com]
|
||||
|
||||
* Support the use of public synonyms with the Oracle adapter; required ruby-oci8 v0.1.14 #4390 [schoenm@earthlink.net]
|
||||
|
||||
@@ -1367,7 +1367,8 @@ module ActiveRecord
|
||||
table_index = join_dependency.table_aliases[aliased_table_name]
|
||||
@aliased_table_name = @aliased_table_name[0..active_record.connection.table_alias_length-3] + "_#{table_index+1}" if table_index > 0
|
||||
end
|
||||
|
||||
join_dependency.table_aliases[aliased_table_name] += 1
|
||||
|
||||
if reflection.macro == :has_and_belongs_to_many || (reflection.macro == :has_many && reflection.options[:through])
|
||||
@aliased_join_table_name = reflection.macro == :has_and_belongs_to_many ? reflection.options[:join_table] : reflection.through_reflection.klass.table_name
|
||||
unless join_dependency.table_aliases[aliased_join_table_name].zero?
|
||||
@@ -1377,7 +1378,6 @@ module ActiveRecord
|
||||
end
|
||||
join_dependency.table_aliases[aliased_join_table_name] += 1
|
||||
end
|
||||
join_dependency.table_aliases[aliased_table_name] += 1
|
||||
end
|
||||
|
||||
def association_join
|
||||
|
||||
Reference in New Issue
Block a user