我是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)
答案 0 :(得分:0)
resources :trips
resources :destinations
end
如果您喜欢上述内容,则会拒绝root/destination
,但会允许root/trip/:id/destination