28

I've been grepping the output of rake routes forever and it just dawned on me that someone must know a better way to inspect routes. I have a resource in my routes.rb name account_groups:

resources :account_groups

Is there anyway to tell rake routes to only return the routes associated with this resource?

Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
spinlock
  • 3,737
  • 4
  • 35
  • 46

4 Answers4

49

You can check for routes of specific controller:
rake routes CONTROLLER=account_groups

As seen in @ZiiCEagle's answer this is deprecated now and you should use
rails routes -c account_groups

Doguita
  • 15,403
  • 3
  • 27
  • 36
24

I usually do rake routes | grep ressource_name.

Also check out Rails HtmlRoutes if you want it nice and pretty in HTML.

jww
  • 97,681
  • 90
  • 411
  • 885
neo
  • 4,078
  • 4
  • 25
  • 41
14
rake routes CONTROLLER=controller_name

has been deprecated in rails 5.1. Now it's

 rails routes -c controller_name
mb21
  • 34,845
  • 8
  • 116
  • 142
4

For a namespaced controller:

CONTROLLER=admin/users rake routes
CONTROLLER=admin/user_sessions rake routes
Fernando Basso
  • 688
  • 1
  • 11
  • 25