我跑耙,我没有看到任何失败原因的线索。我错过了什么?
undefined method `[]' for nil:NilClass
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:525:in `block (3 levels) in <top (required)>'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/Users/ianseabock/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/Users/ianseabock/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:558:in `block (3 levels) in <top (required)>'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/Users/ianseabock/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/Users/ianseabock/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/Users/ianseabock/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/Users/ianseabock/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/bin/rake:23:in `load'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/bin/rake:23:in `<main>'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in `eval'
/Users/ianseabock/.rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:test:load => db:test:purge
class AddSha2PasswordToAdminUsers < ActiveRecord::Migration
def up
add_column :admin_users, :md5_password, :string
add_column :admin_users, :password_salt, :string
Rake::Task['tmp:sessions:clear'].invoke
AdminUser.update_all("md5_password=encrypted_password")
AdminUser.update_all("encrypted_password=null")
end
def down
remove_column :admin_users, :md5_password, :password_salt
end
end
答案 0 :(得分:0)
纠正我的config / database.yml中的错误为我解决了这个问题。