This project is archived and is in readonly mode.
No way to set a global path_name in Routes
Reported by Rizwan Reza | April 2nd, 2010 @ 12:27 PM | in 3.0.2
In Rails 2.3, we could rename path names of our choosing globally in a configuration file. This isn't available in Rails 3.
config.action_controller.resources_path_names = { :new => 'make', :edit => 'change' }
Comments and changes to this ticket
-
Andrew White April 4th, 2010 @ 04:10 PM
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 end
Okay, 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 April 5th, 2010 @ 04:09 PM
- State changed from open to resolved
Good call, thanks. Added to guides: http://github.com/lifo/docrails/commit/f5c54bce20933b6d48dd9f41b498...
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>