Reuse a route path for a custom page

112 views Asked by At

I have a controller named "materiels" I wanted a custom url for all content from this controller, so I have write this in routes. rb

resources :materiels, path: 'materiel-de-mangaka'

Until now, all is fine. I create content and all the content have this custom url Now I want to create a custom page papier.html.erb and reuse the url in order to like /materiel-de-mangaka/papier

So I add this line in routes.rb

get '/materiel-de-mangaka/papier' => 'materiels#papier'

So it doesn't working... How I can route papier.html.erb page by reusing the same url path to become materiel-de-mangaka/papier without create a new content ? Thank you for your time.

1

There are 1 answers

1
AudioBubble On

If it is under a controller: "/controller name/action name"

resources :materiels do member do get 'papier' end end

If it is only "/action name"

get "papier"  => "materiels#papier"