h / html_escape don’t work within a controller method.
I know, it’s for views. (Or was — haven’t done much Rails since v2.3). But I’m just building an eensy-weensy string and want to use this method in my controller.
So how can I escape HTML from within a controller method?
ERB::Util.html_escapeYou can
include ERB::Utilin your controller to use these methods directly.