# Deriving controller/action from a RESTful URL

**URL:** <https://www.ruby-forum.com/t/deriving-controller-action-from-a-restful-url/87221>\
**Category:** Rails\
**Created:** [February 28, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/deriving-controller-action-from-a-restful-url/87221 "2007-02-28T23:32:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crabasa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c57346/32.png) [@crabasa](https://www.ruby-forum.com/u/crabasa)\
**Post date:** [February 28, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/deriving-controller-action-from-a-restful-url/87221/1 "2007-02-28T23:32:25Z")

</div>

If I have a URL/PATH generated via Rails routing:

edit\_foo\_path(foo)) =\> “/foo/1;edit”

…is there some way that I can take that string and get its component  
parts (controller, action, id, etc)??

I’m specifically looking for a solution that doesn’t involve me coming  
up with a regex. I want to rely on code with Rails (which clearly  
must exist).

Thanks!  
Carter Rabasa  
[http://cubanlinks.org](http://cubanlinks.org)
