diff options
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 4 | ||||
-rw-r--r-- | activesupport/test/safe_buffer_test.rb | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 24d0f9319f..231eaedbba 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -150,9 +150,11 @@ module ActiveSupport #:nodoc: else if html_safe? new_safe_buffer = super - unless new_safe_buffer.respond_to?(:frozen?) && new_safe_buffer.frozen? + + if new_safe_buffer new_safe_buffer.instance_variable_set :@html_safe, true end + new_safe_buffer else to_str[*args] diff --git a/activesupport/test/safe_buffer_test.rb b/activesupport/test/safe_buffer_test.rb index fca4b45276..4532152996 100644 --- a/activesupport/test/safe_buffer_test.rb +++ b/activesupport/test/safe_buffer_test.rb @@ -168,10 +168,6 @@ class SafeBufferTest < ActiveSupport::TestCase test 'Should not affect frozen objects when accessing characters' do x = 'Hello'.html_safe - assert_nothing_raised do - x[/a/, 1] - end + assert_equal x[/a/, 1], nil end - - end |