I''m trying to iterate through all tables and fields in a mySQL
database.
<% for i in Model.connection.tables %>
Table Name: <%= i %><br />
<% Model.set_table_name i %>
<% for j in Model.columns %>
Field Name: <%= j.name %><br />
<% 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
columns.
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,
Ryan
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---