```ruby
require "securerandom"

module UniqueToken

  def generate_token_for(attribute)
    loop do
      token = SecureRandom.urlsafe_base64(15)
      if self.class.where(attribute => token).count > 0
        next
      else
        self.send(:"#{attribute}=", token)
        break token
      end
    end
  end

end
```

Append frab 'b' to the confirmation token, since base64 padding confuses URL recognition in email clients.
user
```ruby
require "securerandom"

module UniqueToken

  def generate_token_for(attribute)
    loop do
      token = SecureRandom.urlsafe_base64(15)
      token += 'b'
      if self.class.where(attribute => token).count > 0
        next
      else
        self.send(:"#{attribute}=", token)
        break token
      end
    end
  end

end
```
assistant