Require action_view/helpers instead of rails-html-sanitizer

This will avoid a warning about circular dependencies.

/circular require considered harmful.*rails-html-sanitizer/

This happens because `rails-html-sanitizer` requires `action_view/helpers`
that requires `action_view/helpers/sanitize_helper` that requires
`rails-html-sanitizer`.

I'll properly fix this in rails-html-sanitizer later removing the code
that needs to be added to ActionView::Helpers in that gem.
This commit is contained in:
Rafael Mendonça França 2024-05-31 20:22:14 +00:00
parent 025a83e58b
commit 157f1df8fb
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 2 additions and 3 deletions

@ -10,7 +10,6 @@ class WarningError < StandardError; end
PROJECT_ROOT = File.expand_path("../../../../", __dir__)
ALLOWED_WARNINGS = Regexp.union(
/circular require considered harmful.*delayed_job/, # Bug in delayed job.
/circular require considered harmful.*rails-html-sanitizer/, # Bug when sprockets-rails is not required.
# Expected non-verbose warning emitted by Rails.
/Ignoring .*\.yml because it has expired/,

@ -308,12 +308,12 @@ def load_defaults(target_version)
end
if respond_to?(:action_view)
require "rails-html-sanitizer"
require "action_view/helpers"
action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
end
if respond_to?(:action_text)
require "rails-html-sanitizer"
require "action_view/helpers"
action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
end
when "7.2"