1

让我先说我是一个彻头彻尾的菜鸟。

我刚刚写了一个迁移,但是当我尝试运行时,rake db:migrate --trace我得到了这个错误。

(in /home/dkerschner/hsp-agent)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment

rake aborted!
uninitialized constant ActionController
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
/var/lib/gems/1.8/gems/devise-0.9.1/lib/devise/rails/routes.rb:1
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/devise-0.9.1/lib/devise/rails.rb:1
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/devise-0.9.1/lib/devise.rb:229
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/home/dkerschner/hsp-agent/config/environment.rb:9
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/var/lib/gems/1.8/gems/rake-0.8.7/bin/rake:31
/var/lib/gems/1.8/bin/rake:19:in `load'
/var/lib/gems/1.8/bin/rake:19

我正在尝试使用来自哪里的设计这是我的迁移,它被命名为t.authenticatable20100129183653_change_agent_staff.rb

class ChangeAgentStaff < ActiveRecord::Migration
  def self.up
    change_table :agent_staff do |t|
      t.authenticatable
      t.timestamps
    end
  end

  def self.down

  end
end

这让我发疯!我究竟做错了什么?

4

1 回答 1

2

我之前尝试重新创建它,这在您的迁移中不是问题。问题出在其他地方,您可能想看看是否可以导致应用程序在其他地方出错。启动脚本/服务器并查看您是否可以查看这些页面,或者是否生成错误。

你的应用程序有多远?如果它相当新(并且您知道您安装了有效的 rails 2.3.5),您可能想尝试从头开始。使用设计设置身份验证,随时记录您的命令。然后将您输入的所有命令和代码发布到故障点,我们将能够更好地诊断问题。

我要求这样做是因为当我尝试复制时,有太多不同的方法来设置它 - 使用设计生成器,或手动,并从一开始就使用设计,而不是在用户模型已经完成后添加它创建的。

编辑:此时 change_table 中没有用于设计的 t.authenticable。您必须手动添加它引用的列。

于 2010-01-30T02:47:29.530 回答