Blog posts from   

January February March April May June July August September October November December // 2008
January February March April May June July August September October November December // 2009
January February March April May June July August September October November December // 2011
January February March April May June July August September October November December // 2015

ERB comments in Ruby 1.8.7

will.bryant

After upgrading a server to Ubuntu Intrepid I found that the 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.

Rails db:schema:dump after db:migrate:redo patch

will.bryant

I've submitted another patch to Rails for a minor-but-annoying bug – if you use db:migrate:redo you'll find that it does migrate correctly but the schema dump afterwards doesn't work, so db:test:prepare clones the wrong structure (for example).

The patch fixes things so that second and subsequent db:schema:dump invocations work properly. Testing and +1s, as always, very welcome.