Create seed file from data already in the database

swrobel picture swrobel · Dec 9, 2010 · Viewed 30.1k times · Source

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?

Answer

John Peterson picture John Peterson · Jul 6, 2012

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