Writing a generic active record class for multiple databases and tables

Hello all,

I'm a Ruby on Rails beginner.

Let's say I'm trying to write a Database administration app.

1. Is there a way to query mysql for all the databases available.
2. How do I query a database to get a hash of all the tables availabe.
3. Is it possible to write a dynamic active record class, which can
be used to modify and show records from a selected database and
table. Similar to phpadmin.

Any ideas?