将 Rails3 路由中 :new action 的范围更改为 :member
我需要匹配 /entries/slug-here/new 并将其发送到 EntriesController#new
尝试了以下方法,两种方法都不起作用:(
resources :entries do
member do
get :new
end
end
resources :entries do
get :new, :on => :member
end
带有一堆匹配项的临时硬编码路径,但看起来很丑>。<
更新:
相同使用 create 方法和任何其他规范操作 - 无法重新定义它们。
I need to match /entries/slug-here/new and send it to EntriesController#new
Tried following ways, both didn't work :(
resources :entries do
member do
get :new
end
end
resources :entries do
get :new, :on => :member
end
Temporary hardcoded paths with bunch of matches, but it looks ugly >.<
UPDATED:
Same with create method and any other canonical actions -- couldn't redefine them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知道为什么你需要做这样的事情,但无论如何它应该在你的路线中是这样的。
Not sure why you need to do something like that, but in any case it should be something like this in your routes.