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.
Trojanek Michael M. (Guest)
on 2006-01-20 09: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
Douglas L. (Guest)
on 2006-01-21 17:00
(Received via mailing list)
2006/1/20, Trojanek Michael M. <removed_email_address@domain.invalid>:
> 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.