I have a Mail resource in my application. The default paths for resources :postsgive URLs, for example /posts/:id. Is it possible to delete βmessagesβ from a route and have it instead /:id?
resources :posts
/posts/:id
/:id
You can use the :path'/ posts' bit to remove ...
:path
resources :posts, :path => "/"
Just keep in mind that this may confuse other routes that are defined below in the routes file. For this reason, it is best to have this capture method.
( routes.rb, )
routes.rb
match ':id' => 'posts#show'