我的迁移问题非常烦人.
首先是错误消息:
bundle exec rake db:migrate --trace (in /home/myhomefolder/msdnaa) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! An error has occurred,all later migrations canceled: uninitialized constant Computers
现在我假设我们的一个管理员所做的更新是每次都发生这种情况的原因.即使根本没有迁移!
我所做的(除了在Stack Overflow上搜索解决方案之外)是grep每个文件的“Computers”.
当然有一些文件包含这个单词,我检查了它们的语法错误和通常的东西,如缺少“:”.
然后我问了一个同事一些帮助(他比我更熟练的ruby)他没有线索,一切看起来都正确.
我使用的是稍微旧版本的Ruby(1.8.7)和Rails(3.0.9),但我没有权利对我们的服务器进行更新,所以我必须处理它.
是的,我要求管理员对1.9.x和3.1.x进行更新,但这不是错误,因为它上周工作正常.
所以这是它应该工作的那些错误之一,但它没有,我打赌解决方案很容易就像饮用水,但我不明白!
有什么建议?
编辑:这是–trace:
/var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/inflector/meth ods.rb:113:in `constantize' /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/inflector/meth ods.rb:112:in `each' /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/inflector/meth ods.rb:112:in `constantize' /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/strin g/inflections.rb:43:in `constantize' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:407 :in `load_migration' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:402 :in `migration' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:397 :in `migrate' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:539 :in `migrate' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:615 :in `call' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:615 :in `ddl_transaction' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:538 :in `migrate' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:525 :in `each' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:525 :in `migrate' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:435 :in `up' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:417 :in `migrate' /var/lib/gems/1.8/gems/activerecord-3.0.9/lib/active_record/railties/databas es.rake:142 /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_ chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_ chain' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_tas k' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_e xception_handling' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_e xception_handling' /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run' /var/lib/gems/1.8/gems/rake-0.9.2/bin/rake:32 /var/lib/gems/1.8/bin/rake:19:in `load' /var/lib/gems/1.8/bin/rake:19 Tasks: TOP => db:migrate