module MuckCommerce module OrderMethods def order_number return self.number if !self.number.nil? record = true while record random = Array.new(10){rand(10)}.join record = Order.find(:first, :conditions => ["number = ?", random]) end self.number = random end def dollar_amount self.amount * 0.01 end end end