From 2e9f3b5b0dcd217fb63c060da2f2110422319ee3 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 6 Oct 2018 22:27:54 +0800 Subject: Fix `uninitialized constant ActionText:: ALLOWED_TAGS` error on Rails reloading --- app/helpers/action_text/content_helper.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/action_text/content_helper.rb b/app/helpers/action_text/content_helper.rb index aa2aeba44b..99255494b1 100644 --- a/app/helpers/action_text/content_helper.rb +++ b/app/helpers/action_text/content_helper.rb @@ -1,9 +1,9 @@ module ActionText - SANITIZER = Rails::Html::Sanitizer.white_list_sanitizer - ALLOWED_TAGS = SANITIZER.allowed_tags + [ ActionText::Attachment::TAG_NAME, "figure", "figcaption" ] - ALLOWED_ATTRIBUTES = SANITIZER.allowed_attributes + ActionText::Attachment::ATTRIBUTES - module ContentHelper + SANITIZER = Rails::Html::Sanitizer.white_list_sanitizer + ALLOWED_TAGS = SANITIZER.allowed_tags + [ ActionText::Attachment::TAG_NAME, "figure", "figcaption" ] + ALLOWED_ATTRIBUTES = SANITIZER.allowed_attributes + ActionText::Attachment::ATTRIBUTES + def render_action_text_content(content) content = content.render_attachments do |attachment| unless attachment.in?(content.gallery_attachments) @@ -22,7 +22,7 @@ module ActionText end.chomp end - sanitize content.to_html, tags: ActionText::ALLOWED_TAGS, attributes: ActionText::ALLOWED_ATTRIBUTES + sanitize content.to_html, tags: ALLOWED_TAGS, attributes: ALLOWED_ATTRIBUTES end end end -- cgit v1.2.3