I am working on a website and I am trying to change how the URL looks for the users. As I have all my resources nested, I struggle a lot to do what I want.
At the moment, here are my routes
resources :folders do
resources :portfolio_photos
end
I've changed it to this, which works for the folders index.
resources :folders, except: [:index] do
resources :portfolio_photos
end
get '/photos', to: 'folders#index'
The only problem is that I also want the "portfolio_photos" url to look like this
/photos/:id/portfolio_photos
(and I don't want to change the name of my model).
I've tried that:
get '/photos/:id/portfolio_photos', to: 'portfolio_photos#index'
but it is not working.
Even better would be to get a completely custom URL looking like that on the surface : www.xxxx.com/portfolio_photos even if everything is nested in the backend. Is there a way to change how the url looks without touching the whole backend?
Thanks a lot for your help!