"-" instead of "_" in routes?

Hi all

I’d like to have minus signs “-” instead of underscores “_” in my
routes. Is there an easy to do that?

my_controller/show_something/123 # <= not cool
my-controller/show-something/123 # <= much cooler

Thanks a lot
Josh

On 4/1/07, Joshua M. [email protected] wrote:

Josh
map.connect ‘foo-bar’, :controller => ‘foo_bar’, :action => ‘index’


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

On Sun, Apr 01, 2007 at 07:16:34PM +0200, Joshua M. wrote:

Hi all

I’d like to have minus signs “-” instead of underscores “_” in my
routes. Is there an easy to do that?

my_controller/show_something/123 # <= not cool
my-controller/show-something/123 # <= much cooler

Given that Rails is open source, the answer is certainly yes. You can
monkey-patch the routing process to call #underscore (or just change
hyphens to underscores) before calling #camelize on the URI path.
Alternately, you can alter (monkey-patch) the #camelize method such that
it
deals with hyphens anyway, though that might have unforeseen
consequences.

There is no built in way to do it as far as I know, however.

Thanks a lot
Josh
–Greg