mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
use arel ast construction rather than generating strings
This commit is contained in:
@@ -68,7 +68,13 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def construct_joins
|
||||
"INNER JOIN #{@owner.connection.quote_table_name @reflection.options[:join_table]} ON #{@reflection.quoted_table_name}.#{@reflection.klass.primary_key} = #{@owner.connection.quote_table_name @reflection.options[:join_table]}.#{@reflection.association_foreign_key}"
|
||||
right = join_table
|
||||
left = @reflection.klass.arel_table
|
||||
|
||||
condition = left[@reflection.klass.primary_key].eq(
|
||||
right[@reflection.association_foreign_key])
|
||||
|
||||
right.create_join(right, right.create_on(condition))
|
||||
end
|
||||
|
||||
def join_table
|
||||
|
||||
Reference in New Issue
Block a user