2014-02-14 39 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'而不是指定的路線。

相關問題