【发布时间】:2014-05-12 08:07:25
【问题描述】:
我想要一个测试控制器,我可以在其中轻松添加操作并让路由器自动识别它们。我能够创建一个匹配 any 控制器操作的路由条目(示例 1),但无法弄清楚如何将其限制为测试控制器(示例 2)。
routes.rb:
# EXAMPLE 1: Match any generic controller actions (e.g. any_controller/any_action):
get ':controller/:action
# EXAMPLE 2: Match any test controller actions (e.g. test/any_action):
get 'test/:action'
#2 示例结果导致路由错误:
routing/mapper.rb:229:in `default_controller_and_action': missing :controller (ArgumentError)
【问题讨论】:
标签: ruby-on-rails routing