On 9-Dec-05, at 8:00 AM, Rick O. wrote:
Has anybody figured out a way to generically map URLs with
underscore-named actions? e.g.
members/submit-item -> members#submit_item
Rails provides the members/submit_item -> members#submit_item mapping
for free. Is there something wrong with underscores?
I have heard of two cases where a hyphen is better than an underscore
In HTML, when a URL is used as the text in an anchor tag, the default
in most browsers is to underline the text. In this case the underscore
will blend in with the underline, and some users will mistake it for
when writing the URL down and/or later typing it in.
When indexing a page Google considers the hyphen to be word divider,
underscore is not. So /submit-item will be indexed as “submit item”,
where as submit_item will be “submititem”. GoogleGuy (a Google
has recommended hyphens instead of underscores in URLs if you want the
word boundaries to be recognized.
If there is no preference either way, then I’d suggest using hyphens
instead of underscores in URLs. Its too bad that Rails doesn’t have any
native support to remap them to actions though.