dennismonsewicz
dennismonsewicz

Reputation: 25542

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.

Upvotes: 4

Views: 1591

Answers (1)

dennismonsewicz
dennismonsewicz

Reputation: 25542

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.

Upvotes: 4

Related Questions