-class Token < ActiveRecord::Base
- belongs_to :vote
-
+class Token < ActiveRecord::Base
+ belongs_to :vote
+
def initialize
super
token_generator = UniqueTokenGenerator.new( 16 )
- until not token.empty? and Token.find_all( [ "token = ?", token ]).empty?
+ until not token.empty? and Token.find(:all, :conditions => [ "token = ?", token ]).empty?
self.token = token_generator.token
end