Suppress HTML escaping in link_to(:title)?

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

2006/1/20, Trojanek Michael M. [email protected]:

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="<%[email protected]%>" />

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs