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_escape
You can include ERB::Util
in your controller to use these methods directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With