I'm starting to wonder if this is actually a bug in Ruby? The
documentation of sub! says it should modify the string in place.
The code I posted does something different. After the a.sub!, executing
"puts #{a}" outputs the modified version of a, but inserting that *exact
same* string object into a database puts an UNMODIFIED version of the
string into the DB. It's as if db.execute looks back in time to before
the sub! when it gets the value of a. Something unexplained is going on
here (unless the database module includes a time machine).
--
Posted via http://www.ruby-forum.com/.