Search code examples
ruby-on-railsperformance

how to know unused routes in rails


is there any way to know unused routes in rails over some period, or by any other mean, e.g. by parsing source code and finding out which routes are not called or over some defined period routes those are not been invoked.

I would like to know this because in a huge rails app when developers start adding "resources :objects", it gets loads of unnecessary routes created at run time, I am not sure whether this hits the performance, but still the curiosity.


Solution

  • I found a gem that seems to do this: amatsuda/traceroute. I haven't tried it myself, but judging from the description it does the right thing - checks for resourceful routes that are defined, but a correcponding action is not created.

    But I'd admit one should be very careful with analysing links that are visited and that are not. If no one ever visits this link does not mean it is not going to be visited in the future.