Rails 3 Forces HTML Escape of Forms

I have a legacy application I ported from Rails 2.x. I found that the
escaping was occurring where it shouldn’t, like in creation of forms,
and I couldn’t turn it off. I found two mechanisms that should have
disabled it, a function safe_html, which is supposed to mark a string
as not needing to be escaped. The other is raw, which similarly
indicates that a string should be output in its raw form, even if it’s
not safe HTML. Neither of these mechanisms seem to function for me.
Anyone know of something I might have done to muck up this
functionality? Is there a problematic gem possibly?

Dan

On 13 May 2011 04:26, dlamet [email protected] wrote:

I have a legacy application I ported from Rails 2.x. I found that the
escaping was occurring where it shouldn’t,
Anyone know of something I might have done to muck up this
functionality? Is there a problematic gem possibly?

Without knowing what gems you’re using, or showing some code snippets
from your views, and maybe the associated controller action, and
generated HTML, it’s going to be very vague speculation at best…

Are you using helper methods to output the HTML? If so, you can mark
them as safe by adding

safe_helper :helper_method_name
in the helper file. Then I believe they won’t be escaped.

Adam S.

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