0

我的应用程序上有 Produtor 模型,我正在尝试使用 rails 控制台对其进行调试。

但是当我尝试在我的应用程序目录中使用 rails 控制台时,我收到了这个错误

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>'

问题是什么?

4

1 回答 1

5

您需要改用模型的名称Produtor。额外的 s 会让你失望。试试Produtor.all吧。

于 2012-12-04T17:43:50.043 回答