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+/, "</p><br />\n\n#{start_tag}")  # 2+ newline  -
> paragraph
    text.gsub!(/\r\r+/, "</p><br />\n\n#{start_tag}")  # 2+ newline  -
> paragraph
    text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline   -> br
    text.gsub!("*b*", '<b>')
    text.gsub!("*bb*", '</b>')
    text.gsub!("*r*", '<span class=red>')
    text.gsub!("*rr*", '</span>')
    text.gsub!("*sp*", '&nbsp;')
    text.insert 0, start_tag
    text.html_safe.safe_concat("</p>")
  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 Tineo

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to