X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/c65b1e11059c5cf510b54c785d4a246215058f70..a92ebf4fa0498e973d22fb12d63f4e2d5072c5e5:/app/models/token.rb diff --git a/app/models/token.rb b/app/models/token.rb index 2bab513..e9f4fd6 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -1,11 +1,11 @@ -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