我有一个这样的rails路由配置,当我运行rake routes
时它会显示,但我想这个perfix是restore_link,我怎么能这样做?
restore_links POST /:uid/links/:id(.:format) links#restore
resources :accounts, path: '/', param: :uid, only: [:show] do
member do
resources :links do
collection do
post ':id', to: "links#restore", as: "restore"
end
end
end
end
答案 0 :(得分:2)
resources :accounts, path: '/', param: :uid, only: [:show] do
member do
resources :links, path: 'restore_links' do # <========= `path` option
collection do
post ':id', to: "links#restore", as: "restore"
end
end
end
end