Using a New Builder Version

Hey, folks!

It looks like the version of Builder that’s included with Rails
doesn’t properly escape characters like ampersand in attribute
values, while the current version of Builder (2.0) does.

I’d like to use this new Builder gem, but I can’t seem to get it to
work. I’ve included the following lines at the top of the controller
that needs the new Builder:

require ‘rubygems’
require_gem ‘builder’, ‘~> 2.0’

but ampersands are still not properly being escaped.

If I open up the Rails console, do the require bit above, and then
try to generate XML with an ampersand in an attribute, it’s still not
escaped. If I open up irb and type in the above lines and try to
generate the same XML, the ampersand is escaped. I am extremely
baffled. Can anyone help me out?

Thanks,
Evan