ruby on rails - "undefined local variable or method `n' for main:Object" when trying to run "rake db:populate" -
i'm going through michael hartl's tutorial , can't error:
undefined local variable or method `n' main:object
when run bundle exec rake db:populate
sample_data.rake file
namespace :db desc "fill database sample data" task populate: :environment 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
you have n inside interpolated string next email , not defined anywhere. remove or define it.
Comments
Post a Comment