Create seed file from data already in the database

activerecord, rake, ruby-on-rails, ruby-on-rails-3

Solution

There is a gem called `seed_dump`, which will do exactly what you want:

- https://github.com/rroblak/seed_dump

- http://rubygems.org/gems/seed_dump

Problem

I'm using Rails 3.0.3 and have data for my "categories" table already in the database, but want to create a seed file from it. Is there any rake task that will generate the seeds.rb format for me from this table?

Original source