Skip to content

Commit

Permalink
use railtie to set default sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
tongueroo committed Oct 15, 2023
1 parent 19fd6cd commit 3397489
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rails-html-sanitizer.rb
Expand Up @@ -59,3 +59,5 @@ def deprecate_option(name)
end
end
end

require_relative "railtie" if defined?(Rails)
15 changes: 15 additions & 0 deletions lib/railtie.rb
@@ -0,0 +1,15 @@
require "rails/html/sanitizer"

module Rails
module HTML
class Sanitizer
class Railtie < Rails::Railtie # :nodoc:
initializer "rails_html_sanitizer.sanitizer_vendor" do |app|
ActiveSupport.on_load(:action_view) do
ActionView::Helpers::SanitizeHelper.sanitizer_vendor = Rails::HTML4::Sanitizer
end
end
end
end
end
end

0 comments on commit 3397489

Please sign in to comment.