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






> On Sep 9, 2016, at 11:03 AM, Ariel Juodziukynas <[email protected]> wrote:
> 
> 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 
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1>/actionpack
>  
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/actionpack>/lib
>  
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/actionpack/lib>/action_dispatch
>  
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/actionpack/lib/action_dispatch>/middleware
>  
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/actionpack/lib/action_dispatch/middleware>/templates
>  
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/actionpack/lib/action_dispatch/middleware/templates>/rescues
>  
> <https://github.com/rails/rails/tree/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/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!
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/rubyonrails-core 
> <https://groups.google.com/group/rubyonrails-core>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

----

Jason Fleetwood-Boldt
[email protected]
http://www.jasonfleetwoodboldt.com/writing

If you'd like to reply by encrypted email you can find my public key on 
jasonfleetwoodboldt.com <http://jasonfleetwoodboldt.com/> (more about setting 
GPG: https://gpgtools.org) 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to