Rails3 Routes - 将参数传递给成员路由 [英] Rails3 Routes - Passing parameter to a member route
本文介绍了Rails3 Routes - 将参数传递给成员路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想向资源的成员路由传递一个额外的参数
I would like to pass an extra parameter to a member route of a resource
类似:
resources :events do
member do
get 'register/:participant_type_id'
end
end
我只能使用静态匹配语句来完成它
I could only accomplish it using a static match statement
环顾互联网,我发现这在 Rails 3.0.2 中是可能的.我正在使用 3.0.1,但它确实不是.
Looking around the internet I saw that this might be possible in Rails 3.0.2. I'm using 3.0.1 and it certanlly is not.
我做错了吗?还是真的不可能?
Am I doing something wrong? or is it really not possible?
谢谢
推荐答案
试试这个:
resources :events do
member do
get 'register/:participant_type_id', :action => 'register'
end
end
这篇关于Rails3 Routes - 将参数传递给成员路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文