How can I get information about controller and action names for any (not only current) url, if there is a route rule for this?
For example:
function_i_need('/pages/5')
returns
{:controller => 'page', :action => 'show', :id => 5}
UPD: Answer found Rails parse url to hash(Routes)
你可以这样做:
Rails.application.routes.recognize_path "/pages/5"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.