From 17f8474e9a44519f8bfa5f37482d044400e00559 Mon Sep 17 00:00:00 2001 From: Marcello Barnaba Date: Mon, 20 Nov 2017 11:24:28 +0100 Subject: [PATCH] Do not rely on AV configuration on R5 and up --- lib/sanitize/rails/engine.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sanitize/rails/engine.rb b/lib/sanitize/rails/engine.rb index 0fae83c..40df6ac 100644 --- a/lib/sanitize/rails/engine.rb +++ b/lib/sanitize/rails/engine.rb @@ -17,7 +17,9 @@ def configure(config) # FIXME: Remove this, as it is meant only not to break assumptions on old # applications. # - if defined?(::ActionView::Base) && + require 'rails' + + if defined?(::ActionView::Base) && Rails.version.to_i < 5 && ::ActionView::Base.respond_to?(:sanitized_allowed_tags) && ::ActionView::Base.sanitized_allowed_tags.respond_to?(:size) && ::ActionView::Base.sanitized_allowed_tags.size > 0