I have a resource 'Post' in my app. The default routes for resources :posts gives urls like /posts/:id. Is it possible to remove 'posts' from the route, and just have /:id instead?
2 Answers
You can use :path to remove the '/posts' bit...
resources :posts, :path => "/"
Just be aware that this could confuse other routes which are defined below it in your routes file. It's best to have this kind of catch-all route at the bottom for this reason.
1 Comment
Dogbert
Ah, I just found answers saying 'path_prefix' => '/'. I guess it was changed to 'path' in Rails 3. Thanks!