2017-05-06 12 views
0

私はレールのルートを設定していますが、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

あなたが働いて、このいずれかを取得しましたか? –

+0

いいえ、私は最終的に 'post:uid/links /:id 'を使用して、" links#restore "のようにリソースブロックの外に" restore_link "を入れます。 – Tsao

+0

私はperfixをカスタマイズしたいのですが、 – Tsao

答えて

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 
関連する問題