【发布时间】:2014-02-25 13:53:58
【问题描述】:
我是 RoR 的新手,我正在为这里的路线而苦苦挣扎。我需要的是允许我的应用程序获取这样的路由:
root/trip/:id/destination
但拒绝这样的路由:
root/destination
我的路由文件如下所示:
resources :destinations
resources :trips do
resources :destinations
end
root to: "trips#index"
当我从路由中取出第一行时,嵌套链接会中断。我想要完成的是从
-> /root/trip(with linke to new file with new view)
-> /root/show_all_destinations (with its own index and show action) and than
-> /root/show_all_destination/:id (without edit/new/delete)
【问题讨论】:
-
请阅读更多关于胭脂guides.rubyonrails.org/routing.html的信息。对你有很大帮助。
-
我正在这样做,但我的代码中还有其他问题。我解决了它,现在从根作品中否认......
标签: ruby-on-rails routes nested-resources