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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -