2014-02-14 23 views
0

我有一个名为five9_lists_controller.rb的控制器。Five9ListsController不是Rails支持的控制器名称

我想说这项工作很好,当它是一个单一的命名惯例,但我把它改为复数,我的测试,现在抛出这个错误:

/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:239:in 
`default_controller_and_action': 'Five9ListsController' is not a supported controller 
name. This can lead to potential routing problems. See 
http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use (ArgumentError) 

为什么是无效的控制器名称?

回答

2

您是否在您参考的指南部分最后找到了注释?

Only the directory notation is supported. Specifying the controller with ruby constant notation (eg. :controller => 'Admin::UserPermissions') can lead to routing problems and results in a warning.

事实上,这正是所产生你所看到的消息:

https://github.com/rails/rails/blob/v4.0.0/actionpack/lib/action_dispatch/routing/mapper.rb#L237

尝试用controller: 'five9_lists_controller'而不是指定的路线。

相关问题