Reputation: 38812
I have the actual request and I would like to know the name of the route that Rails has resolved.
For example, if I have this route:
front_page GET /front/pages/:id(.:format)
And the actual request is:
/front/pages/10 (GET)
I would like to have as result:
front_page
Upvotes: 3
Views: 2228
Reputation: 46
IMHO you could use the code explained by KinOfCain on How can I find out the current route in Rails?
Rails.application.routes.router.recognize(request){ |route, matches, parameters| puts route.name }
The router is not storing the route recognized in any place at least I wasn't able to find it
Upvotes: 3