Forum: Ruby on Rails adding a destination anchor in the link

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.
90ea347c45cdfbc1c5767dd6304d9c10?d=identicon&s=25 Borja =?iso-8859-1?Q?Mart=EDn?= (Guest)
on 2006-01-12 19:11
(Received via mailing list)
hi, I would like to specify a destination anchor in the generated link
with
the link_to helper, so the navigator opens the document at the given
point.
it should look something like this:
/blog/archive/2006/01/10/test-post.html#comments
I tried it with the following code:
<% link_to("comments",
   :controller => "blog",
   :action => "archive",
   :year => post.date.year,
   :month => post.date.month,
   :day => post.date.day,
   :id => "#{post.id}.html#comments") %>

the problem is that that the '#' char is escaped and printed
as  "/blog/archive/2006/01/10/test-post.html%23comments" so it doesnt
work

is there any way to avoid a link from being escaped? any possible
solution
for this?

thanks in advance
317aad7f9f0b69a440faca74bbe22b20?d=identicon&s=25 Jakob Skjerning (Guest)
on 2006-01-12 22:28
(Received via mailing list)
On Jan 12, 2006, at 19:16, Borja Martín wrote:

> hi, I would like to specify a destination anchor in the generated link

:anchor => 'comments'

--
Jakob Skjerning - http://mentalized.net
This topic is locked and can not be replied to.