1 class Voter < ActiveRecord::Base
5 before_create :create_password
8 token_generator = UniqueTokenGenerator.new( 16 )
9 until password and not password.empty? \
10 and Voter.find_all( [ "password = ?", password ]).empty?
11 self.password = token_generator.token