mirror of
https://github.com/github/rails.git
synced 2026-01-28 07:48:00 -05:00
Remove superfluous code and quote table name. References #9971 [jkit, nzkoz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8015 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -442,9 +442,8 @@ module ActiveRecord
|
||||
|
||||
# Returns a table's primary key and belonging sequence.
|
||||
def pk_and_sequence_for(table) #:nodoc:
|
||||
table_desc_result = execute("describe #{table}")
|
||||
keys = []
|
||||
execute("describe #{table}").each_hash do |h|
|
||||
execute("describe #{quote_table_name(table)}").each_hash do |h|
|
||||
keys << h["Field"]if h["Key"] == "PRI"
|
||||
end
|
||||
keys.length == 1 ? [keys.first, nil] : nil
|
||||
|
||||
Reference in New Issue
Block a user