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: