how to handle '<a name= ' links?

hey all i have a <a name="item">item</a> 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

Hi Patrick,

Patrick Aljord 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

One more clue...

The ascii hex value for '#' is 23

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