def before_create_save(record)
  vouchercode = generate_vouchercode(8)
  while Voucher.find(:first, :conditions => {:vouchercode => vouchercode})
...

Ruby While loop to get unique value

by dive.myopenid.com, January 06, 2009 16:44, 5 refactorings, tagged with while, uniqueness

Coming from python, I would...

6cb63e2304cb64236520d0e3e353c9bc Talk