Non-English resourceful routes

I previously wrote about resourceful routes improvement in edge that will provide URLs independent of resources path names in application. This is a great benefit for Non-English URLs.

But that didn’t solved ‘new’ and ‘edit’ parts of URL.

Finally this improvement and bugfix follow-up did just that:

          map.resources :cars, 
                        :as => 'kola', 
                        :path_names => { :new => 'novo', 
                                         :edit => 'izmena' }
          

...so that:

          new_car_path      # => /kola/nova 
          edit_car_path(17) # => /kola/17/izmena
          

...will map nicely to appropriate controller actions.

To globally set new values use:

          ActionController::Base.resources_path_names = { 
            :new => 'novo', 
            :edit => 'izmena' }
          

« Home | This article was published on April 24, 2008.

Any thoughts?