This project is archived and is in readonly mode.
No way to set a global path_name in Routes
-
Andrew White
I've been looking at this today and I don't think it's a good idea to be putting it back in. You can override using a scope and it keeps the configuration all in one place. Also adding a global config would override resources defined in engines and plugins resulting in hard to track down bugs.
Ideally we'd give application routes precedence over plugin/engine routes (#2592), then to localize routes you'd do something like the following:
# my_plugin/config/routes.rb Rails.application.routes.draw do |map| resources :categories do resources :products end end # my_application/config/routes.rb MyApplication::Application.routes.draw do |map| scope(:resources_path_names => { :new => "neu", :edit => "bearbeiten" }) do resources :categories, :path => "kategorien" do resources :products, :path => "produkte" end end endOkay, you'd end up redefining all of the plugin's routes but that's not an onerous task and would probably have to be done anyway to customize the resource path names. Alternatively maybe they'd be better off as I18n keys in the current locale since that's the primary purpose of this feature.
-
Rizwan Reza
- State changed from open to resolved
Good call, thanks. Added to guides: http://github.com/lifo/docrails/commit/f5c54bce20933b6d48dd9f41b498...