# I'm trying to prepend a parameter to all of my routes

**URL:** <https://www.ruby-forum.com/t/im-trying-to-prepend-a-parameter-to-all-of-my-routes/156032>\
**Category:** Rails\
**Created:** [December 19, 2008, 4:37pm UTC](https://www.ruby-forum.com/t/im-trying-to-prepend-a-parameter-to-all-of-my-routes/156032 "2008-12-19T16:37:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Hinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb8c5e/32.png) [@Jon\_Hinson](https://www.ruby-forum.com/u/Jon_Hinson)\
**Post date:** [December 19, 2008, 4:37pm UTC](https://www.ruby-forum.com/t/im-trying-to-prepend-a-parameter-to-all-of-my-routes/156032/1 "2008-12-19T16:37:56Z")

</div>

I’m developing a facebook app and all of my routes go something like  
this :org\_id/:controller/:action/:id , where all of my urls will be  
prepended by this org\_id. Is there a way to have all routes recognize  
this org\_id, even the generated named routes? I have the following in  
my routes.rb:

map.connect ‘:org\_id’, :controller =\> ‘orgs’, :action =\> ‘index’  
map.connect ‘:org\_id/:controller/:action/:id’  
map.connect ‘:org\_id/:controller/:action:/id.:format’

When I try to go to a route like [www.example.com/groups/1](http://www.example.com/groups/1), I get this  
message:

No action responded to 1

So how do I make all routes recognize the prepended :org\_id without  
manually making an entry for each one?

Thank you,  
Jon

---

<div class="post-metadata">

**Author:** ![Jon\_Hinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb8c5e/32.png) [@Jon\_Hinson](https://www.ruby-forum.com/u/Jon_Hinson)\
**Post date:** [December 19, 2008, 6:04pm UTC](https://www.ruby-forum.com/t/im-trying-to-prepend-a-parameter-to-all-of-my-routes/156032/2 "2008-12-19T18:04:17Z")

</div>

Never mind, I found the solution- :path\_prefix
