Joey Hilton
Joey Hilton

Reputation: 81

Ruby on Rails seed db syntax error

I am trying to seed a db in a rails app and I keep getting this error when I run the rake db:seed command:

db/seeds.rb:3: syntax error, unexpected tIDENTIFIER, expecting ')' email: "[email protected]"

this is my code. Please help.

User.create!(first_name:  "Example",
             last_name: "User"
             email: "[email protected]",
             password:              "password",
             password_confirmation: "password")

9.times do |n|
  first_name  = Faker::Name.first_name
  last_name  = Faker::Name.last_name
  email = "example-#{n+1}@projectman.net"
  password = "password"
  User.create!(first_name:  first_name,
               last_name:   last_name,
               email: email,
               password:              password,
               password_confirmation: password)
end

Upvotes: 2

Views: 667

Answers (1)

Mohammad AbuShady
Mohammad AbuShady

Reputation: 42919

You're missing a comma

User.create!(first_name:  "Example",
             last_name: "User"     <=== here
             email: "[email protected]",
             password:              "password",
             password_confirmation: "password")

Upvotes: 3

Related Questions