The seed-dump gem generates db/seeds.rb
for a Rails project from an existing database. It also works outside of Rails with
standalone-migrations, but you
need to jump through a couple of hoops to set up the Rake task and give it access
to your model classes.
In your Gemfile:
gem 'seed_dump'