I am trying to make some alias for my rails route like this 'events/8/event_participants/new'
to /business-meet/registration
, My routes are written like this:
resources :events, only: [], shallow: true do
resources :event_participants, only: [:new, :create, :edit, :update] do
post :complete, on: :collection
member do
get :invite, :add_people, :accept_invitation, :invitation_success, :reserved
put :refer
end
end
end
I want the alias for the specific event id 8, I tried with redirect
, but it actually redirect to the the route, so the whole route is visible in the browser, I want the to keep visible /business-meet/registration
routes to my browser.
您可以在路线中使用match
方法。
match '/business-meet/registration', to: 'event_participants#new', via: :get, defaults: { event_id: 8 }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.