title: Generating unique token on the fly with Rails
body: <p>I want to generate a token in my controller for a user in the "user_info_token" column. However, I want to check that no user currently has that token. Would this code suffice?</p>
  
  <pre><code>  begin
      @new_token = SecureRandom.urlsafe_base64 
      user = User.find_by_user_info_token(@new_token) 
    end while user != nil 
  
    @seller.user_info_token = @new_token 
  </code></pre>
  
  <p>Or is there a much cleaner way to do this?</p>