Hi there, I have a few internationalized resources: map.resource :vendors, :path_prefix => "/:locale" map.resource :contacts, :path_prefix => "/:locale" map.resource :galleries, :path_prefix => "/:locale" I''m using globalite to keep track of all the translated strings and set the locale in a before_filter in the application_controller. Nothing fancy going on here. I would like the url of "/galleries" to default to "/us/galleries", but not redirect the user to /us/galleries, if that makes sense. I''m sensing there is some route or before_filter magic I must perform, but I''m not sure what that magic should be. An :optional_path_prefix hash is what I''m looking for... maybe? Thanks! -Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
oruenu
2007-Nov-01 09:32 UTC
Re: RESTful routes, Globalite, an optional locale path_prefix?
Hi. Recently I''ve ran into the same problem. Have you found any clues? And I wonder how you dealt with named routes. I have problems with named routes for nested resources like this: routes.rb map.resources :galleries, :has_many => :photos, :path_prefix => ":locale" some_view.html.erb gallery_photo_path(@gallery, @photo) #it produces an error because of missing :locale On Oct 23, 9:36 pm, Dave <dhoef...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi there, > > I have a few internationalized resources: > > map.resource :vendors, :path_prefix => "/:locale" > map.resource :contacts, :path_prefix => "/:locale" > map.resource :galleries, :path_prefix => "/:locale" > > I''m using globalite to keep track of all the translated strings and > set the locale in a before_filter in the application_controller. > Nothing fancy going on here. > > I would like the url of "/galleries" to default to "/us/galleries", > but not redirect the user to /us/galleries, if that makes sense. I''m > sensing there is some route or before_filter magic I must perform, but > I''m not sure what that magic should be. An :optional_path_prefix hash > is what I''m looking for... maybe? > > Thanks! > -Dave--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---