Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Populate the database with seed data

Anja Kammer edited this page Jan 3, 2018 · 2 revisions

Rails got a functionality to fill the database with basic data via app/db/seeds.rb. We are using 2 other tools, to extend the functionalities of seeds: seed_dump and seedbank

For exploring them run: 'rake --tasks' you will get:

  • rake db:seed
  • rake db:seed:common
  • rake db:seed:development
  • rake db:seed:development:base
  • rake db:seed:dump
  • rake db:seed:original
  • rake db:seed:usability_tests
  • rake db:seed:usability_tests:student_test
  • Use rake db:seed:dump to dump the current database data into the db/seeds.rb file please get this generated code out of the file and use another folder for it like db/seeds/development or db/seeds/usability_tests. The db/seeds.rb file is getting overwritten everytime you are using this command.

  • The command rake db:seed:development will run after calling rake db:seed if the current environment is 'development'

  • for specific seeds, create the seeds like this underneath db/seeds/*/*seeds.rb like we did with db/seeds/usability_tests/student_test

Clone this wiki locally