Hyphenated Controller Routes plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://svn.vickeryj.com/public/hyphenated_controller_routes/trunk/
Example
=======
Take for example a controller named ContactUs. The normal default routing would recognize paths in the form /contact_us/:action/:id adding a call to map.add_hyphenated_routes before the default routing line will create the named route "contact_us" "/contact-us/:action/:id"
If, instead ContactUs is routed using the RESTful map.resources call, the standard named routes and helper will be created, but with hyphens instead of underscores (GET /contact-us index contact_us_url).
Here is a sample config.routes
-
ActionController::Routing::Routes.draw do |map| #a resource that will be mapped with an underscore map.resources :non_hyphenated_resources #turn on hyphenated resources map.use_hyphenated_resources() #all following resources will use hyphens (contact-us) map.resource :contact_us # add hyphenated routes with higher priority than the default routes map.add_hyphenated_routes # Install the default routes map.connect ':controller/:action/:id.:format' map.connect ':controller/:action/:id' end
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: Guest, about 1 month ago

