Hello,
Trying to upgrade an app that was running fine in 3.0.3 to 3.0.9 and
while everything works well, I get this error:
ActionView::Template::Error (Cannot modify SafeBuffer in place):
When passing a string to this function (in application_helper.rb)
through a simple: <%= format_me(article[shortdesc])%>
def format_me(text, html_options={}, options={})
text = ‘’.html_safe if text.nil?
start_tag = tag(‘p class=grey’, html_options, true)
text = sanitize(text) unless options[:sanitize] == false
text.gsub!(/\r\n?/, “\n”) # \r\n and \r -> \n
text.gsub!(/\n\n+/, “
\n\n#{start_tag}”) # 2+ newline -
paragraph
text.gsub!(/\r\r+/, “
\n\n#{start_tag}”) # 2+ newline -
paragraph
text.gsub!(/([^\n]\n)(?=[^\n])/, ‘\1
’) # 1 newline -> br
text.gsub!(“b”, ‘’)
text.gsub!(“bb”, ‘’)
text.gsub!(“r”, ‘’)
text.gsub!(“rr”, ‘’)
text.gsub!(“sp”, ’ ')
text.insert 0, start_tag
text.html_safe.safe_concat("")
end
I don’t understand well enough what changed between 3.0.3 and 3.0.9 to
understand what I should change in this function and what part is now
wrong.
Can anyone help? Thanks!
Cedric T.