mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
use the schema cache when asking for the primary key
This commit is contained in:
@@ -72,7 +72,7 @@ module ActiveRecord
|
||||
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'
|
||||
|
||||
Reference in New Issue
Block a user