def rollback(ref = nil)
      tran = self
      inverse_entry = self.class.prepare do
        tran.debit_amounts.each { |di| debit(di.account, -di.amount) }
        tran.credit_amounts.each { |ci| credit(ci.account, -ci.amount) }
        transactionable(ref || tran)
        description("Rollback of #{tran.description}")
      end
      inverse_entry.save!

      unless inverse_entry.new_record?
        self.rollback_entry = inverse_entry
        self.save!
      end

      inverse_entry
    end
def rollback(ref = nil)
      tran = self
      inverse_entry = self.class.prepare do
        tran.debit_amounts.each { |di| debit(di.account, -di.amount) }
        tran.credit_amounts.each { |ci| credit(ci.account, -ci.amount) }
        transactionable(ref || tran)
        description("Rollback of #{tran.description}")
      end
      inverse_entry.save!

      unless inverse_entry.new_record?
        self.rollback_entry = inverse_entry
        self.save!
      end

      inverse_entry
    end
TODO: not work