Is it possible to export data from a database, or run something like Person.find(1).to_seed and copy the output from console into the seeds.rb file?
Yes.
Here's a gem – https://github.com/rroblak/seed_dump — that does exactly that.
Try using seed-fu. You can give SeedFu::Writer a CSV file which will be used to generate a file in the seeds.rb "format". Of course using some database tool you would need to export the database table into a CSV file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With