Browse files

use the schema cache when asking for the primary key

  • Loading branch information...
1 parent 400929f commit d12e6d0e2f71aa82db2338258d252600a79b35ba @tenderlove tenderlove committed Dec 12, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/attribute_methods/primary_key.rb
View
2 activerecord/lib/active_record/attribute_methods/primary_key.rb
@@ -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'

0 comments on commit d12e6d0

Please sign in to comment.