1

I am trying to populate my db using rake db:populate. I am on chapter 10.3.2 on michael hartl's book.

Even though I don't get any error messages the DB doesn't seem to be populating.

This is the sample_data.rake file I created:

  namespace :db do   desc "Fill database with sample data"   task populate: :environment do
        User.create!(:name => "Example User",
                     :email => "[email protected]",
                     :password => "foobar",
                     :password_confirmation => "foobar")
        99.times do |n|
          name  = Faker::Name.name
          email = "example-#{n+1}@railstutorial.org"
          password  = "password"
          User.create!(:name => name,
                       :email => email,
                       :password => password,
                       :password_confirmation => password)
        end   
     end 
  end
4
  • ok the problem fixed itself... Commented Aug 11, 2013 at 4:30
  • I'm having the same problem, could you explain how you fixed it ? Commented Jan 2, 2014 at 16:32
  • Silly answer : restart your rails server (worked for me, don't ask me why) ! Commented Jan 2, 2014 at 17:54
  • +1 This helped me solve the same problem I was having in Chapter 9 of the Ruby on Rails Tutorial by Michale Hartl. A simple server restart did the trick. Thank you! Commented Apr 10, 2014 at 1:52

1 Answer 1

2

Stopping your server before resetting and repopulating your db should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.