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, 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jon Hinson
2008-Dec-19 17:03 UTC
Re: I''m trying to prepend a parameter to all of my routes
Never mind, I found the solution- :path_prefix On Dec 19, 8:29 am, Jon Hinson <hinson.jonat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 likewww.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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---