# RESTful routes, Globalite, an optional locale path\_prefix?

**URL:** <https://www.ruby-forum.com/t/restful-routes-globalite-an-optional-locale-path-prefix/118091>\
**Category:** Rails\
**Created:** [October 23, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/restful-routes-globalite-an-optional-locale-path-prefix/118091 "2007-10-23T20:37:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://www.ruby-forum.com/u/dave)\
**Post date:** [October 23, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/restful-routes-globalite-an-optional-locale-path-prefix/118091/1 "2007-10-23T20:37:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://www.ruby-forum.com/u/dave)\
**Post date:** [November 1, 2007, 10:33am UTC](https://www.ruby-forum.com/t/restful-routes-globalite-an-optional-locale-path-prefix/118091/2 "2007-11-01T10:33:37Z")

</div>

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
