Displaying 1 result from an estimated 1 matches for "self_numb".
Did you mean:
self_nmi
2009 May 28
3
strange behaviour in ActiveRecord transaction
Hi,
I''m using an ActiveRecord transaction in a Rails app,
and one of the changes made during the transaction is reverted
as the transaction finishes, whilst the other changes are preserved.
The code is like:
------------------------
def swap(other)
self_number=self.number #==1
other_number=other.number #==2
ActiveRecordModel.transaction do
version=Version.find_by_kind(self.kind)
#version.number==30
self.number=other_number
other.number=self_number
self.save
other.save
version.number+=1
version.save
#self...