Excerpt
You're close :)
```plain text
#lib/tasks/defaultuser.rake
require 'rake'
namespace :defaultuser do
task :adduser => :environment do
...
end
```
Note the use of :environment, which sets up the necessary Rails
environment prior to calling the rake task. After that, your User object
will be in scope.
You're close :)
```plain text
#lib/tasks/defaultuser.rake
require 'rake'
namespace :defaultuser do
task :adduser => :environment do
...
end
```
Note the use of :environment, which sets up the necessary Rails
environment prior to calling the rake task. After that, your User object
will be in scope.