Sometimes we need to work with existing database and turn it into rails db schema script, this can cost you insane amount of time, here is a fast way to do it.
1. modify the database.yml to point to the database you want to generate from
2. rake db:schema:dump, now schema.rb should have scripts to create all the tables
3. modify the database.yml to point back to the correct database
4. rake db:schema:load, now the destination database should have all the tables