Skip to content

Commit

Permalink
Fix Action Text sanitizer initialization
Browse files Browse the repository at this point in the history
Using `initializer` in the engine may run the block before application
initializers. Instead, use `config.after_initialize` to ensure that
application initializers take effect properly.

Also, don't bother deleting the config value, since that pattern isn't
needed here (as it is in other railties like action_view/railtie.rb).
  • Loading branch information
flavorjones committed Jul 17, 2023
1 parent 3faa629 commit ebe9166
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actiontext/lib/action_text/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def to_trix_content_attachment_partial_path
ActionText::Attachment.tag_name = app.config.action_text.attachment_tag_name
end

initializer "action_text.sanitizer_vendor" do |app|
if klass = app.config.action_text.delete(:sanitizer_vendor)
config.after_initialize do |app|
if klass = app.config.action_text.sanitizer_vendor
ActionText::ContentHelper.sanitizer = klass.safe_list_sanitizer.new
end
end
Expand Down

0 comments on commit ebe9166

Please sign in to comment.