好的,我在我的路由中有这个循环。Rb文件
[:animals, :humans].each do |app|
resources app, controller => "mammals", type: app.to_s do
member do
post :deny
end
collection do
get :wait, :state => 'wait', :action => 'index'
end
end
end
但是我得到这个错误错误的参数数(0 for 1)
/Users/trace/.rvm/gems/ruby-1.9.3-p327@sss/gems/actionpack-3.1.10/lib/action_dispatch/routing/mapper.rb:651:in `controller'
/Users/trace/Sites/sss/config/routes.rb:31:in `block (2 levels) in <top (required)>'
/Users/trace/Sites/sss/config/routes.rb:30:in `each'
,但我在路由的其他部分使用循环。一切都很好
知道发生了什么吗?可能是语法错误
这看起来很可疑:
resources app, controller => "mammals", type: app.to_s do
如何:
resources app, controller: "mammals", type: app.to_s do
控制器上缺少冒号。
resources app, controller => "mammals", type: app.to_s do
应该 resources app, :controller => "mammals", type: app.to_s do