Best way to populate development database

What would be the best way to populate a development database for a
Rails 3 app? I have looked at faker, but it seems that development has
stopped, any other options?

Do you have your app deployed? What I do is populate development with
a recent backup of my live server every once in a while. That way I'm
seeing what the users are (at least until it drifts).

How do you do it? Regular sql dump tool (like mysqldump) and then some rake task for importing it on the development database?

no rake task needed. if you have the mysqldump, use the following (assuming the dump is dump.sql)

mysql -u root -p database < dump.sql

obviously :smiley:

I was just thinking that could reuse configuration in your database.yml (for credentials, database location, etc)

My app is not live yet so I will need some sort of random data
generator for this.

You can check the machinist gem (https://github.com/notahat/machinist/tree/1.0-maintenance) with Sham (https://github.com/panthomakos/sham) and company. Be aware though that it’s pretty slow for big amounts of data (one database write per record)

If you wish to do it via code you can put stuff in db/seeds.rb then run it via
rake db:seed

Colin

How about faker and populator? See:

  http://railscasts.com/episodes/126-populating-a-database

Steve

Thanks everyone, I went with faker and this rake file:

https://gist.github.com/300536