Module: Formtastic::Util

Extended by:
Util
Included in:
Util
Defined in:
lib/formtastic/util.rb

Instance Method Summary collapse

Instance Method Details

#html_safe(text) ⇒ String

Returns the given text, marked as being HTML-safe. With older versions of the Rails XSS-safety mechanism, this destructively modifies the HTML-safety of ‘text`.

Parameters:

  • text (String)

Returns:

  • (String)

    ‘text`, marked as HTML-safe



16
17
18
19
20
21
22
# File 'lib/formtastic/util.rb', line 16

def html_safe(text)
  if text.respond_to?(:html_safe)
    text.html_safe
  else
    text
  end
end