X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/fc0a6a8d7ea15bcdb27ebdd58721401c7045c6e0..d66a99486376939d64f8a5d9032dcc516f7b1195:/app/models/token.rb?ds=sidebyside diff --git a/app/models/token.rb b/app/models/token.rb old mode 100755 new mode 100644 index 2bab513..e9f4fd6 --- 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