Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 Generate Seed file from single Database Table

I have tried scouring the mighty google, but can't seem to find what I am looking for (probably because what I am wanting to do is stupid)

But, is there a way to create a seed file from just a single database table instead of dumping the entire database contents?

Essentially, I have a Products table and I am just wanting to generate a seed file from this table.

like image 979
dennismonsewicz Avatar asked Oct 23 '25 18:10

dennismonsewicz


1 Answers

Found what I was looking for using this Rails Gem https://github.com/rhalff/seed_dump

Use this Code:
rake db:seed:dump MODELS=User

Obviously replace User with the model name you are wanting to work with, or a comma separated list of models.

like image 187
dennismonsewicz Avatar answered Oct 26 '25 23:10

dennismonsewicz