jeudi 12 mai 2016

rake db:seed not working as expected

I am trying to seed a database with initial users. The first two are testing accounts and populate fine:

User.create! :name => "Name", :surname => "Lastname", :admin => 't', :email => "admin@testing.co", :encrypted_password => "Password"

User.create! :name => "name", :surname => "lastname", :admin => 'f', :email => "test@faker.tld", :encrypted_password => "Password"

However, the error (NameError: undefined local variable or methodname' for main:Object` is triggered when I try to run:

8.times do
 User.create! :name => Faker::Name.first_name, :surname => Faker::Name.last_name, :admin => 'f', :email => Faker::Internet.email(name + "." + surname), :encrypted_password => Faker::Internet.password(10)
end

I can't figure out the problem. Any help? Thanks.

Aucun commentaire:

Enregistrer un commentaire