Tom Riley
2006-Oct-28 12:17 UTC
Way to assign global prefix to all restful resource routes?
Hi, I''m using the restful resource style routes in edge-rails and I''m not trying to work the globalize-rails plugin into my app. I want to create URLs like: http://www.myapp.tld/en/things;new http://www.myapp.tld/fr/things/3 etc. ... with the locale as the first thing in the URL. I''m now having to define a :path_prefix for every resource in my routes.rb: map.resources :units do |unit| unit.resources :spaces, :path_prefix => /:locale/units/:unit_id'' end map.resources :photographables do |photographable| photographable.resources :photo_links, :path_prefix => /:locale/:photographable_type/:photographable_id'' end map.resources :price_rules do |price_rule| price_rule.resources :prices, :path_prefix => /:locale/price_rules/:price_rule_id'' end ...and so on. A lot of repetition and a loss of DRYness having to repeat the resource names in the prefixes. Does anyone know of a way that I could specify a prefix globally for all routes? Tom -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---