我在Heroku的Rails 3.1.3上遇到了这个rake任务的问题:
task :update => :environment do
# Get the Assignments
@a = Assignment.all
# Change the dates
for a in @a
a.new_start_date = a.start_due if a.a.new_start_date.nil?
a.new_due_date = a.due_date if a.a.new_due_date.nil?
a.description =+ "This assignments was edited by an update task. This task updated the due date.
This action was taken by our auto-updateder at #{Time.now.utc} UTC. If you
have questions please contact support. This update
was started by CEO, XA." if a.a.new_due_date.nil?
a.save!
end
end
我收到了这个错误:
Running rake update:duedate:update attached to terminal... up, run.1
fatal: Not a git repository (or any of the parent directories): .git
rake aborted!
uninitialized constant Object::Assignment
Tasks: TOP => update:duedate:update
(See full trace by running task with --trace)
这是跟踪:
Running rake update:duedate:update --trace attached to terminal... up, run.1
fatal: Not a git repository (or any of the parent directories): .git
** Invoke update:duedate:update (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute update:duedate:update
rake aborted!
uninitialized constant Object::Assignment
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing'
/app/lib/tasks/update.rake:40:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => update:duedate:update