search for: activerecordmodel

Displaying 1 result from an estimated 1 matches for "activerecordmodel".

2009 May 28
3
strange behaviour in ActiveRecord transaction
...eRecord 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.number==2 #other.number==1 #version.number==31 end #self.number...