aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 558b341c06..78159d13d4 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -707,6 +707,10 @@ module ActiveRecord #:nodoc:
# Returns an array of column objects for the table associated with this class.
def columns
+ if defined?(@primary_key)
+ connection_pool.primary_keys[table_name] ||= primary_key
+ end
+
connection_pool.columns[table_name]
end