Has anybody figured out a way to generically map URLs with hyphens to
their corresponding
underscore-named actions? e.g.
members/submit-item → members#submit_item
thanks
csn
Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
cool_screen_name90001 wrote:
Has anybody figured out a way to generically map URLs with hyphens to
their corresponding
underscore-named actions? e.g.
members/submit-item -> members#submit_item
thanks
csn
Don’t count on it - I think those #'s would be seen as browser entities
(they’re used for putting links to a specified place on the page), so I
don’t think they’d get sent to the server.
On 12/9/05, Thomas [email protected]
[email protected] wrote:
cool_screen_name90001 wrote:
Has anybody figured out a way to generically map URLs with hyphens to
their corresponding
underscore-named actions? e.g.
members/submit-item → members#submit_item
thanks
csn
Rails provides the members/submit_item → members#submit_item mapping
for free. Is there something wrong with underscores?
–
rick
http://techno-weenie.net
On 9-Dec-05, at 8:00 AM, Rick O. wrote:
Has anybody figured out a way to generically map URLs with
hyphens to
their corresponding
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 URLs:
In HTML, when a URL is used as the text in an anchor tag, the default
styling
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
a space
when writing the URL down and/or later typing it in.
When indexing a page Google considers the hyphen to be word divider,
while an
underscore is not. So /submit-item will be indexed as “submit item”,
where as submit_item will be “submititem”. GoogleGuy (a Google
employee)
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.
–
Thanks,
Dan
CSN wrote:
Has anybody figured out a way to generically map URLs with hyphens to their corresponding
underscore-named actions? e.g.
members/submit-item → members#submit_item
This may not be exactly what you want, but it may help.
http://blog.teksol.info/articles/2005/10/25/actions-with-dashes