# Removing the path\_prefix from a route

**URL:** <https://www.ruby-forum.com/t/removing-the-path-prefix-from-a-route/91731>\
**Category:** Rails\
**Created:** [April 11, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/removing-the-path-prefix-from-a-route/91731 "2007-04-11T22:32:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [April 11, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/removing-the-path-prefix-from-a-route/91731/1 "2007-04-11T22:32:44Z")

</div>

Let’s say I have a resource defined…  
map.resources :user do |user|  
user.resource :profile  
user.resource :foo  
end

I’ve got everything working so to\_param spits out the username instead  
of  
the id, so now I have urls like

/user/homer  
/user/homer/profile  
/user/homer/foo

How would one go about removing the /user/ from the route? Is it  
possible?

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [August 19, 2008, 9:04pm UTC](https://www.ruby-forum.com/t/removing-the-path-prefix-from-a-route/91731/2 "2008-08-19T21:04:30Z")

</div>

Brian,

Did you figure out a way to do this besides using .sub on the generated  
URL?

Thanks,  
Wes
