[英]How do I route :collection to use /controller/action/:id in rails 2.3 & 3?
If I have code that looks like this: 如果我有这样的代码:
:collection => {
:download_print_use => :get
}
rake routes dosn't show me how to use :id to map to something like /controller/download_print_use/:id 耙路线并没有告诉我如何使用:id映射到类似/ controller / download_print_use /:id的对象
what do I need to do to make this work? 我需要做些什么才能使这项工作?
Because that's the point of the collection option. 因为那是收集选项的重点。 Ex:
events/download_print
. 例如:
events/download_print
。
I think you need to use :member => {}
to get what you want. 我认为您需要使用
:member => {}
来获得所需的内容。
It's the same principle in rails 3, but with a more elegant syntax. 它与Rails 3中的原理相同,但是语法更优雅。 You can read this paragraph to understand it better: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions
您可以阅读此段落以更好地理解它: http : //guides.rubyonrails.org/routing.html#adding-more-restful-actions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.