Is there anything like sanitize for controllers?
thanks
Is there anything like sanitize for controllers?
thanks
The way I do this is as follows:
# in application_controller.rb
def helpers
Helper.instance
end
class Helper
include ActionView::Helpers::TextHelper
include ActionView::Helpers::SanitizeHelper
end
# in your controller
def index
@message = "Sanitized #{helpers.sanitize(...)}"
end
This namespaces your helpers in the controller, kind of, by extending an inner class. I hope this helps!