Skip to content

Instantly share code, notes, and snippets.

@pifleo
Created April 4, 2012 19:01
Show Gist options
  • Save pifleo/2304771 to your computer and use it in GitHub Desktop.
Save pifleo/2304771 to your computer and use it in GitHub Desktop.
Rails - I18n routes translation with nested resources and members
$ rake routes | grep users
...
followed_projects_user GET /users/:id/followed_projects(.:format) users#followed_projects
questions_user GET /users/:id/questions(.:format) users#questions
parameters_user GET /users/:id/parameters(.:format) users#parameters
...
# routes translation
# https://github.com/kwi/i18n_routing
gem 'i18n_routing'
fr:
routes:
users:
as: utilisateurs
path_names:
new: 'nouvel'
edit: 'edition'
parameters: parametres
followed_projects: projets-suivis
...
localized([:fr]) do
resources :users do |user|
get :followed_projects, :on => :member
get :questions, :on => :member
get :parameters, :on => :member
resources :companies
resources :profiles, :except => [ :index, :new, :create ]
resources :subscriptions
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment