.columns refresh


I’m trying to iterate through all tables and fields in a mySQL database.

<% for i in Model.connection.tables %>
Table Name: <%= i %>

    <% Model.set_table_name i %>

<% for j in Model.columns %>
Field Name: <%= j.name %>

<% end %>

<% end %>

I’m using: Model.connection.tables to get an array of table names, and I
change the table_name in a Model, then try to iterate through it’s

However… it seems that Model.columns is only calculated once, because
I’m only getting the fields of the 1st table to show up under every
table name.

I’ve tried looking at the reload()[1], with no luck

[1] http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M001052

Any ideas???

Thank You,