Houdini
Houdini

Reputation: 3542

Changing my 'seed' file - Rails

I have already seeded my user into the database, but now I would like to change one of those fields. It seems, like the migrations, I cannot just edit the file and run rake db:seed. That doesnt seem to change anything. How do I edit something I have already seeded in? Thanks!

Upvotes: 1

Views: 1016

Answers (1)

trh
trh

Reputation: 7339

You can use the console to change data you've already seeded, or is otherwise already in your database. If it's a lot of data you need to change you can write a migration to make changes to the data, as well as the table structure.

To use the console

rails c
> u = User.last
> u.first_name = "BoyGeorge"
> u.save

Upvotes: 2

Related Questions