ERB comments in Ruby 1.8.7

Tags:

After upgrading my server to Ubuntu Intrepid I found that this Rails site’s layouts broke. The problem is this issue resulting from a ERB code change in Ruby 1.8.7: if you put a # Ruby comment in a one-line <% %> block, all the content up to the next %> that’s on a subsequent line is ignored.

This is really annoying, but since not everyone agrees this should work anyway you may need to work around it yourself – put the closing %> on the next line.

It’s worth noting that Ruby 1.8.7 is still not recommended for Rails apps due to such issues; stick with Ruby 1.8.6 if you can. Ubuntu users can either stick with Hardy, or pin the Ruby packages to Hardy’s version.

9 SUN November 2008 7:07 p.m. (+1300)

Comments

  • Post a comment
    This will be kept private.