In routes.rb, I’m using resources to declare all common routes for a controller:
resources :photos
This creates URLs which look like this:
http://example.com/photos
http://example.com/photos/new
...
How do I remove photos from the URLs? That is, how do I map this controller to the root of the application?
You can route a resourceful controller to the root by adding the
pathoption:And, of course, this can still be extended in the usual way;
For more information, see Module
ActionDispatch::Routing::Mapper::Resources > resources > Supported options in the API documentation.