I need to turn HTML into plain text. There\'s a nice function that does that in ActionView\'s SanitizeHelper, but I have trouble understanding how I can reference it and use
Ideally you would require and include ActionView::Helpers::SanitizeHelper but there are several dependencies that don't get included when you do that. You can require them yourself to be able to use strip_tags.
require 'erb'
require 'active_support'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/string/encoding'
require 'action_view/helpers/capture_helper'
require 'action_view/helpers/sanitize_helper'
include ActionView::Helpers::SanitizeHelper
strip_tags("lol") # => "lol"
This is assuming you have rails 3 gems installed.