[Proposal|Feature request]Add an option to not render the routes table on Routing Error page

I have a project with +2600 routes, the error page takes almost 2 seconds to load because it renders the _route partial +2600 times (sums up almost 1.5 seconds of the total time) and most of the time the table is not really needed if you are familiar with the code.

An option to disable the routes table will be greate to improve speed of development for those like me that doesn’t really need that table.

I would be happy to add that option myself, but I don’t know where to put it, I only know that, with that config value, I have to add a check in rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb:19

<% if confg.render_routes_table and @routes_inspector %>

``

Any advise on it? any reason not to do it? thanks!

Why do you need 2600 routes?

It sound like your design is the flaw here. An app shouldn’t have 2600 controllers, maybe you’ve mapped content directly to controllers? I’d recommend re-thinking that decision and sending the majority of those requests to a single controller, and then let it decide what content to show based on the params or based on part of the path string.

You would only need 2600 routes if you also had 2600 controllers (hard to believe) and each controller had different Ruby functionality.

If you basically have 2600 different routes routed to the same Ruby code, then you aren’t using Rails correctly.

Using the routes table just to segregate your content is an abuse of the Rails router itself, as you really should be using routes to segregate functionality, not content.

-Jason

I’m not following you, how would I have only one route for my users controller if just using resources: :user adds 7 routes all pointing to the same controller just for the REST actions? not counting that I also need more routes to extra actions. It’s a really big project, almost 100 models, an admin panel (with more routes), also some gems adds extra routes.

I’m sure I can have less routes making some refactors but I don’t understand how would I have only one route per controller.

Anyway, I think the situation is not that crazy and the proposal is not that unnecesary, it’s just a config value to make a response faster not showing info that one, as developer, might not need.

From those 2600 routes, Typus gem generated +1800 routes, I’m sure I can reduce some obsolete routes from my code, but Typus generates a lot of routes because admin users have actions to handle most of the models on the project and I can’t do much about that.