Hello. How can I parse url string to hash like
{:controller => 'controller_name', :action => 'action_name', :id => 'id'}
?
Hello. How can I parse url string to hash like
{:controller => 'controller_name', :action => 'action_name', :id => 'id'}
?
You may be able to use ActionController::Routing::Routes.recognize_path
, depending on the format of the URL:
>> ActionController::Routing::Routes.recognize_path("/accounts/1",:method=>:get)`
# {:action=>"show":controller=>"accounts",:id=>"1"}
More info on this blog post