Forum: Ruby on Rails ActiveRecord and refreshing column info

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ian W. (Guest)
on 2006-05-08 23:22
Let's say I want to find out what column names exist in two tables,
table_a and table_b.

One way I've been doing this is using ActiveRecord and the column info
it returns. After establishing a connection for ActiveRecord, I do the

column_names_a = ActiveRecord::Base.column_names
column_names_b = ActiveRecord::Base.column_names

The problem I have is that once I set the table_name to 'table_a',
ActiveRecord always returns table_a's column info. I've tried the
following ActiveRecord methods to clear the info in column_names &
neither has worked


Even after removing & then restablishing the connection, the
column_names method continues to return table_a's columns.

So I'm obviously on the wrong track here. But I can't find out where I
should be headed. Any ideas?


Versions being used:
Ruby 1.8.4
RoR 1.1
This topic is locked and can not be replied to.