0
如何使第二條路線有效?覆蓋資源的「顯示」路線
resources :users, only: [:edit, :update]
get ':id', :to => 'users#show', :as =>'user'
的Rails給出錯誤,因爲第二行:(擴大我的意見,未來的觀衆參考)
Invalid route name, already in use: 'user' You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
嘗試切換路線的順序,以改變他們的優先級。 – kwarrick
謝謝!有用!你能把它作爲答案嗎? – Gediminas