我有/users/1/settings
和/profile/1/settings
。如何修改路由以使其更简单,例如/settings
?
routes.rb中:
get 'signup' => 'users#new'
get 'login' => 'sessions#new'
get 'logout' => 'sessions#destroy'
get 'edit' => 'users#edit'
get "/profile/:id" => "users#show"
get "profile/:id/settings" => 'users#edit'
get 'settings/:id' => 'users#settings'
resources :users do
get 'settings', on: :member
post 'follow', on: :member
post 'unfollow', on: :member
get "follow", on: :member
end
end
答案 0 :(得分:0)