mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #4843 from seamusabshere/patch-1
Possibly clearer way of getting rid of ` and "
This commit is contained in:
commit
bbd2caeaf9
1 changed files with 1 additions and 1 deletions
|
@ -526,7 +526,7 @@ module ActiveRecord
|
||||||
execute_and_free("SHOW CREATE TABLE #{quote_table_name(table)}", 'SCHEMA') do |result|
|
execute_and_free("SHOW CREATE TABLE #{quote_table_name(table)}", 'SCHEMA') do |result|
|
||||||
create_table = each_hash(result).first[:"Create Table"]
|
create_table = each_hash(result).first[:"Create Table"]
|
||||||
if create_table.to_s =~ /PRIMARY KEY\s+\((.+)\)/
|
if create_table.to_s =~ /PRIMARY KEY\s+\((.+)\)/
|
||||||
keys = $1.split(",").map { |key| key.gsub(/[`"]/, "") }
|
keys = $1.split(",").map { |key| key.delete('`"') }
|
||||||
keys.length == 1 ? [keys.first, nil] : nil
|
keys.length == 1 ? [keys.first, nil] : nil
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
|
Loading…
Reference in a new issue