Forum: Ruby on Rails Suppress HTML escaping in link_to(:title)?

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.
7cf29b843f314453bb71ac49cd18260c?d=identicon&s=25 Trojanek Michael Marc (Guest)
on 2006-01-20 08:16
(Received via mailing list)
Hi guys,

I'm new to this list and it seems you are my last hope.

How can I prevent Rails from automatically escaping HTML entities when
creating a hyperlink?

You know, link_to( ... :title => 'This is „quoted“') returns
'This is „quoted“' because Rails escapes the ampersands to
&.

Is there a way I can stop/alter this behaviour so I can use these
numeric references in my title tag?

Kind regards

.mitro
Eeba234182bcbd7faed9ff52e233394d?d=identicon&s=25 Douglas Livingstone (Guest)
on 2006-01-21 16:00
(Received via mailing list)
2006/1/20, Trojanek Michael Marc <tro@adv.magwien.gv.at>:
> Is there a way I can stop/alter this behaviour so I can use these
> numeric references in my title tag?
>

I think the easiest way would be to write out the link by hand, using
url_for instead of link_to.

Something like: <a href=<%= url_for .... %> title="<%=@title%>" />

Though I think you have a bug somewhere else. Why do you have escaped
HTML stored as data? Are you escaping input? (a bad idea)

The only reason I can think of at the moment to store escaped HTML
would be as a caching thing, perhaps you could use the built in Rails
caching?

Douglas
This topic is locked and can not be replied to.