aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-06-07 23:32:03 -0700
committerJosé Valim <jose.valim@gmail.com>2011-06-07 23:32:03 -0700
commit185235333c7b345e7cbb6384446c89d8447f5d79 (patch)
tree927652f818cedfe42a9c3ae9777dd97dd524874d /actionpack
parentfcccfd7b6d4c89bf2904c87da4833b8527d4b8e8 (diff)
parentef8b12a29e27ea01547779cb3a45b60ff90816b4 (diff)
downloadrails-185235333c7b345e7cbb6384446c89d8447f5d79.tar.gz
rails-185235333c7b345e7cbb6384446c89d8447f5d79.tar.bz2
rails-185235333c7b345e7cbb6384446c89d8447f5d79.zip
Merge pull request #1542 from cmeiklejohn/dont_gsub_on_safebuffer
Don't operate on the safebuffer, operate on a string and convert.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb3
1 files changed, 2 insertions, 1 deletions
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+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
text.insert 0, start_tag
- text.html_safe.safe_concat("</p>")
+ text = ActiveSupport::SafeBuffer.new(text).safe_concat("</p>")
end
# Creates a Cycle object whose _to_s_ method cycles through elements of an