0
나는 내 레일 routes.rb에서 다음과 같습니다만들기 레일 라우팅 아름다운
Prefix Verb URI Pattern Controller#Action
sign_up POST /sign_up(.:format) sign_ups#create
new_sign_up GET /sign_up/new(.:format) sign_ups#new
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
activate_user GET /users/activate/:token(.:format) users#activate
내가 get 'users/activate/:token' ...
경로를 제거하고 싶습니다 : 나에게 다음과 같은 경로를 제공
resource :sign_up, only: [:new, :create]
resources :users
get 'users/activate/:token' => 'users#activate', as: 'activate_user'
대신 중첩 또는 범위 지정을 사용하여 알아낼 수는 없습니다. 이것을 달성 할 수있는 방법이 있습니까?
감사합니다.
resources :users do
collection do
get 'activate/:token', :action => :activate, :as => :activate
end
end
을 그리고는 다음과 같이 당신에게 경로를 제공합니다 :
감사합니다. id없이 'member' 블록을 사용하는 방법에 대한 아이디어가 있습니까? 목표는 명명 된 라우트에 대해'activate_users' 대신'activate_user'입니다. – cmoel