map.resources :x, :as => 'y'

Somehow I’ve missed this two months old improvement, that will mean a lot for non-english Rails apps.

From its creation, Resources had a convention without configuration for resource route names and URL. One determines another.

Finally, Rails edge (set to be in Rails 2.1) has this feature:

          map.resources :comments, :as => 'komentari'
          

This will give you restful route names in English (preferred for code readability), while letting you customize resource name in URL (ie. /komentari/17).

UPDATE: This article has a follow-up.

« Home | This article was published on March 26, 2008.

Any thoughts?