提交 d12e6d0e 编写于 作者: A Aaron Patterson

use the schema cache when asking for the primary key

上级 400929fb
......@@ -72,7 +72,7 @@ def get_primary_key(base_name) #:nodoc:
when :table_name_with_underscore
base_name.foreign_key
else
if ActiveRecord::Base != self && connection.table_exists?(table_name)
if ActiveRecord::Base != self && connection.schema_cache.table_exists?(table_name)
connection.primary_key(table_name)
else
'id'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册