mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
just use the regexp directly
This commit is contained in:
parent
de708447f4
commit
9094cd2600
1 changed files with 4 additions and 6 deletions
|
@ -58,18 +58,16 @@ module ActiveRecord
|
|||
when Arel::Table
|
||||
right.name.downcase == name ? 1 : 0
|
||||
when String
|
||||
count_aliases_from_string(right.downcase, quoted_name)
|
||||
# Table names + table aliases
|
||||
right.downcase.scan(
|
||||
/join(?:\s+\w+)?\s+(\S+\s+)?#{quoted_name}\son/
|
||||
).size
|
||||
else
|
||||
0
|
||||
end
|
||||
}.sum
|
||||
end
|
||||
|
||||
def count_aliases_from_string(join_sql, name)
|
||||
# Table names + table aliases
|
||||
join_sql.scan(/join(?:\s+\w+)?\s+(\S+\s+)?#{name}\son/).size
|
||||
end
|
||||
|
||||
def instantiate(rows)
|
||||
primary_key = join_base.aliased_primary_key
|
||||
parents = {}
|
||||
|
|
Loading…
Reference in a new issue