strange behaviour in ActiveRecord transaction

I'm using an ActiveRecord transaction in a Rails app,
with Rails 2.3.2, Windows (Vista), MySQL 5.0.
No exception is being raised in the transaction, but one of the
changes made during the transaction is reverted
as the transaction finishes, whilst the other changes are preserved.
(Using "puts ..." shows the values displayed in comments in the code
below.) The same reversion is consistently happening.
The code is like:

This was not an issue with ActiveRecord/Rails.
(I had to use "self.number=" instead of "number=". Using "number="
wasn't actually calling the function "number=",
but I presume was creating a local variable "number" instead.)

I just noticed that in the code sample I submitted, I actually
wrote "self.number=". In my original code I had "number=".