Rails 3 Creates a seed file from a separate database table

I tried to clear powerful Google, but I can not find what I was looking for (probably because I want to do stupid things)

But is there a way to create an initial file from only one database table instead of dumping the entire contents of the database?

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

+3
source share
1 answer

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 Userwith the name of the model you want to work with, or a list of models separated by commas.

+4
source

All Articles