使用rails控制台错误

时间:2012-12-04 17:41:54

标签: ruby-on-rails ruby console

我的应用程序上有Produtor模型,我正在尝试使用rails console进行调试..

但是当我尝试在我的app目录中使用rails console时出现此错误

D:\ruby\app>rails console
Loading development environment (Rails 3.2.9)
irb(main):001:0> Produtors.all
NameError: uninitialized constant Produtors
        from (irb):1
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

问题是什么?

1 个答案:

答案 0 :(得分:5)

您需要使用模型的名称Produtor。额外的东西是什么让你失望。请改为Produtor.all