From ef8b12a29e27ea01547779cb3a45b60ff90816b4 Mon Sep 17 00:00:00 2001
From: Christopher Meiklejohn
Date: Tue, 7 Jun 2011 23:07:07 -0400
Subject: Don't operate on the safebuffer, operate on a string and convert.
---
actionpack/lib/action_view/helpers/text_helper.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'actionpack/lib/action_view')
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 75422a343d..8f97eb7d75 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -258,11 +258,12 @@ module ActionView
text = ''.html_safe if text.nil?
start_tag = tag('p', html_options, true)
text = sanitize(text) unless options[:sanitize] == false
+ text = text.to_str
text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n
text.gsub!(/\n\n+/, "
\n\n#{start_tag}") # 2+ newline -> paragraph
text.gsub!(/([^\n]\n)(?=[^\n])/, '\1
') # 1 newline -> br
text.insert 0, start_tag
- text.html_safe.safe_concat("")
+ text = ActiveSupport::SafeBuffer.new(text).safe_concat("")
end
# Creates a Cycle object whose _to_s_ method cycles through elements of an
--
cgit v1.2.3