I don’t know the correct terminology to describe what I’m trying to do,
so I’ll just try to explain it the best I can.
I’m the guinea pig at work to start using Ruby and RoR. My project is
to make a web app that is basically just a simple drop down menu that
lists the names of all the tables in a particular MySQL database, then
when the user clicks on one of the table names, then hits “submit” it
will show them a nice neat html table of all the data in that table. I
have already made the list.rhtml file that shows all the data in a
table. What I need now is to start on the drop down menu. I could easily
make the drop down menu and hard code the names of all the tables into
it, but the kicker is that we need it to be dynamically updatable.
Meaning that if someone comes along and adds another table to the
database, or removes one, the drop down menu is automatically updated to
reflect this change and of course if you click on it and hit submit, it
will show you all the data.
So, forgive my ignorance, I’m new when it comes to Ruby and RoR, but is
there a way to, for lack of a better term, “sync” RoR with a database so
that it can automatically be updated when tables are added or removed,
or can you only “sync” it with the individual tables. Sorry for the bad
terminology, I hope you can understand what I am trying to do and what
my question is. In other words, will I have to run the
scaffold/controller/model scripts every time a new table is added, and
hard code the name of the new table into the drop down list, or is there
a way for ruby to automatically update itself anytime a new table is
added to the database?
Thanks in advance.