undefined local variable or method `n' for main:Object" when trying to run
"rake db:populate
I'm going through Michael Hartl's tutorial and I can't get past the error
"undefined local variable or method `n' for main:Object" when I run
"bundle exec rake db:populate".
sample_data.rake file
namespace :db do
desc "Fill database with sample data"
task populate: :environment do
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
No comments:
Post a Comment