]> projects.mako.cc - selectricity/blob - app/models/token.rb
Merge from jdong
[selectricity] / app / models / token.rb
1 class Token < ActiveRecord::Base
2   belongs_to :vote 
3
4   def initialize
5     super
6
7     token_generator = UniqueTokenGenerator.new( 16 )
8     until not token.empty? and Token.find(:all, :conditions => [ "token = ?", token ]).empty?
9       self.token = token_generator.token
10     end
11
12     self
13   end
14
15   def to_s
16     self.token
17   end
18 end

Benjamin Mako Hill || Want to submit a patch?