What I want to accomplish is the ability to use a dash in my URL's. I
have done some poking around but have not come up with much. The only
place I really need the dashes right now are in the action area. So
my URL would look like:
http://www.mydomain.com/content/site-map
If I may correct you; I'd guess that you don't *need* hyphens in your
URL, you *want* them, and needs/wants are very different things.
There's probably no reason why you can't use an underscore instead to
keep nicely with a Rails convention:
http://www.mydomain.com/content/site_map
is just as readable, and possible, more SEO friendly (contentious
issue: hypen vs. underscore...)
Hypens are seen by Ruby as the "subtract operator", and you can't put
an operator in a function name definition (which is what a controller
action is). So you couldn't do things like:
{:url => {:controller => :content, :action => :site-map } }
without Ruby throwing the dummy out of the pram, and even:
{:url => {:controller => :content, :action => "site-map" } }
would annoy Rails, but you should be able to do:
{:url => {:controller => :content, :action => :site_map, :page =>
"cool-stuff" } }
or
{:url => {:controller => :content, :action => :site_map, :page =>
"cool-stuff".intern } }
To use them in the action parameter with success, you would have to
make sure you've re-written routes to map your hyphens to a different
character, which you use in the names of the controller action
methods.... but *why* would you go to all that work, risking one
mistake breaking everything, when sticking to the convention makes
your life so easy?
HTH
Michael