ruby on rails - Faker: Don't know how to build task 'enviroment' -
i have sample_data.rake file:
namespace :db desc "fill patients sample data" task populate: enviroment patient.create!(name: ["example", "user"], email: "example@gmail.com" password: "foobar" password_confirmation: "foobar" age: "26" doctor_id: "3" dao: "true" active: "true") 350.times |n| name=faker::name.name email = "example-#{n+1}@gmail.com" password = "password" age = (25...45).sample doctor_id = [2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22].sample dao = ["true", "false"].sample active = "true" patient.create!(name: name, email: email, password: password, password_confirmation: password, age: age, doctor_id: doctor_id dao: dao, active: active) end end end
it placed on lib/tasks, , when run rake db:populate i'm getting next error.
rake aborted! don't know how build task 'enviroment' /home/marcpursals/.rvm/gems/ruby-1.9.3-p448@migtrace/bin/ruby_noexec_wrapper:14:in `eval' /home/marcpursals/.rvm/gems/ruby-1.9.3-p448@migtrace/bin/ruby_noexec_wrapper:14:in `<main>' tasks: top => db:populate
i double checked other posts: (how build task 'db:populate' , faker "don't know how build task? , rake aborted uploading images using faker ruby project.) , didn't help.
does solved issue this?
thanks lot in advance.
enviroment
should :environment
, correctly spelled symbol.
task populate: :environment # ...
Comments
Post a Comment