method

html_safe

v5.2.3 - Show latest stable - Class: String
html_safe()
public

Marks a string as trusted safe. It will be inserted into HTML with no additional escaping performed. It is your responsibility to ensure that the string contains no malicious content. This method is equivalent to the raw helper in views. It is recommended that you use sanitize instead of this method. It should never be called on user input.

1Note

use raw() instead

ssoroka ยท Oct 20, 20107 thanks

Don't use this method unless you're sure your string isn't nil. Instead use the raw() method, which wont raise an exception on nil.