Reputation: 284
I have a database that I want to continually add data to. From what I gathered about seeds.rb is that it can be used to give the database initial values. Is it still common practice to use seeds.rb if you want to continue to update the database with new values? If so, how?
Upvotes: 1
Views: 264
Reputation: 207
seeds.rb will not remove any records from your database (unless you code it to, of course). So you can use seeds.rb whenever you want to add more data. Just run rake db:seed.
That said, if your seeds.rb file just contains constant data, you will be duplicating records in your database if you run it repeatedly, which you probably don't want. So, you should either change your seeds.rb file each time you run it, or find a way to add data dynamically (ie randomly or by pulling it from some variable external source)
Upvotes: 1