2

Within my ruby on rails application I have the seeds file, which contains data on the users such as:

User.create(:password => "jb", :password_confirmation => "jb", :role => 'admin', :first_name => "Joe", :last_name => "Bloggs",  :house_no => "1", :street => "A Street", :town => "A Town", :postcode => "ABC1 2DE", :email => "anemail@anemailaddress.co.uk")

But when I run rake db:setup it removes all the users data that I have entered into the database through the application (which is fine and expected) but does not enter the users data from the seeds.

I'm not sure if this makes a difference but I recently did three consecutive scaffolds.

What am I doing wrong?

2 Answers2

1

I think you are looking to do a rake db:seed. Here is a good explanation of the other db rake tasks Difference between rake db:migrate db:reset and db:schema:load

Community
  • 1
  • 1
Sean
  • 983
  • 5
  • 13
1

db:seed runs the db/seed.rb file

db:schema:load loads the schema into the current env's database

db:setup runs both db:schema:load and db:seed

Joel
  • 4,503
  • 1
  • 27
  • 41