Lost my schema.rb! Can it be regenerated?

Careful,

rake db:schema:dump

will dump the current DB schema FROM the DB. This means that if you made any changes to your migrations, they will NOT be reflected in schema.rb file which is not what you want IMO.

If you want to re-create the schema from the migrations, do the following:

rake db:drop  # ERASES THE DATABASE !!!! 
rake db:create
rake db:migrate

If you run a rake -T it will list all possible rake tasks for your Rails project. One of them is db:schema:dump which will recreate the schema.rb for the Rails app from the database.

bundle exec rake db:schema:dump