Answer the question
In order to leave comments, you need to log in
How to make a redirect in routes for multilevel resources?
There are, for example, the following resources:
resources :publishers do
resources :magazines do
resources :photos
end
end
/publishers/:publisher_id/magazines/:magazine_id, to: redirect('что_то')
Answer the question
In order to leave comments, you need to log in
Try this
resources :publishers do
resources :magazines, except: :show do
get :show, to: redirect { |path_params, req| "/publishers/#{path_params[:publisher_id]}/magazines/#{path_params[:magazine_id]}/photos" }
resources :photos
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question