Last Updated: February 25, 2016
·
564
· leomao10

Find Routing info base on uri

With this code, I can get controller, action information base on a path

Rails.application.routes.recognize_path(path)

To get controller information, just do:

Rails.application.routes.recognize_path(path)[:controller]

And for action:

Rails.application.routes.recognize_path(path)[:action]