Skip to content

Instantly share code, notes, and snippets.

@thehenster
Created March 27, 2012 11:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thehenster/2215231 to your computer and use it in GitHub Desktop.
Save thehenster/2215231 to your computer and use it in GitHub Desktop.
How to remove/disable the automatic XSS protection helper html escaping for Rails 3
# dirty way to completely remove the automatic escaping of html in rails helpers
# useful to get your Rails 2 -> 3 upgrade running to the point where the raw/.html_safe additions can be delegated
module CustomHtmlSafe
def html_safe?
true
end
end
class ActionView::OutputBuffer
include CustomHtmlSafe
end
class ActionView::SafeBuffer
include CustomHtmlSafe
end
class String
include CustomHtmlSafe
end
@mtrepanier
Copy link

Do you put this in a initializer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment