Remove html tags from string in controller, how?


#1

Been searching for a function that can do this, but have onl found a
helper function.

is there a way to strip all html tags of a string in a controller?

Thanks


#2

paul wrote:

Been searching for a function that can do this, but have onl found a
helper function.

is there a way to strip all html tags of a string in a controller?

Thanks

This should work

class SomeController < AC::B
include ActionView::Helpers::TextHelper

def foo
  @escaped_string = strip_tags('<h1>Foo</h1>')
end

end


#3

cool, thanks :slight_smile: