Files
nairobi/app/helpers/text_with_links_helper.rb
2015-10-26 01:25:53 +01:00

15 lines
383 B
Ruby

module TextWithLinksHelper
def text_with_links(text)
return unless text
sanitized = sanitize(text, tags: [], attributes: [])
Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe
end
def safe_html_with_links(html)
return html unless html.html_safe?
Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe
end
end