Trojanek Michael Marc
2006-Jan-20 06:39 UTC
[Rails] 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
Douglas Livingstone
2006-Jan-21 14:58 UTC
[Rails] Suppress HTML escaping in link_to(:title)?
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