how to use strip_tags and truncate inside my Model.rb?
You can also access helpers in your models like this:
ActionController::Base.helpers.strip_tags(text)
ActionView::Base.full_sanitizer.sanitize(your_html_string)
This will work for you. Or you can define a helper like:
def strip_html_tags(string)
ActionView::Base.full_sanitizer.sanitize(string)
end
And then use this like:
strip_html_tags(your_html_string)
To remove some specific tags pass additional parameters. Source: Sanitize Rails API Dock