Forum: Ruby on Rails Generically mapping URLs with hyphens to actions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-12-07 22:18
(Received via mailing list)
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
06f64907e3c1b4f2c5ef4f1e730c87c6?d=identicon&s=25 Thomas <ruby-forum-com@ikwisthet.net> (Guest)
on 2005-12-09 16:05
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.
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 technoweenie (Guest)
on 2005-12-09 17:05
(Received via mailing list)
On 12/9/05, Thomas <ruby-forum-com@ikwisthet.net>
<ruby-forum-com@ikwisthet.net> 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
Ea627ef000ec92c6cdd5a4c14075e740?d=identicon&s=25 dan.kubb (Guest)
on 2005-12-09 18:31
(Received via mailing list)
On 9-Dec-05, at 8:00 AM, Rick Olson 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
A539f55ee4798b0736e616e942e412ca?d=identicon&s=25 paul.abraham (Guest)
on 2005-12-09 19:18
(Received via mailing list)
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/action...
This topic is locked and can not be replied to.