How to handle '<a name= ' links?


#1

hey all
i have a item and im trying to do a link that way:

link_to 'item',:action=>'show',:id=>@item+'#item'

but i get %23item instead of the #item.

any idea whats wrong?

thanx in advance

Pat


#2

Hi Patrick,

Patrick A. wrote:

link_to ‘item’,:action=>‘show’,:id=>@item+’#item

but i get %23item instead of the #item

Coupla thoughts…

  1. Rails may need you to use braces to parse that correctly.
    e.g., link_to ‘item’, {:action=>‘show’,:id=>@item+’#item’}

  2. Rails may have trouble with ‘#’ as part of a symbol.

What’s the full string you’re getting back in params[:id] ? That might
shed
some light.

hth,
Bill


#3

One more clue…

The ascii hex value for ‘#’ is 23


#4

thanx, i found it. anchor=> does the job :slight_smile: