I'm using rails for authentication and want to validate the uniqueness of a username, unless the other username was set up as a temporary account.
Example: We set up a user account that has name: "buddy" with email: "placeholder@email.com"
A user comes and creates an account. We want the user to be able to user the name "buddy" if the only other buddy account is associated with email: "placehoder@gmail.com".
Bascially I want to do something along the lines of:
validates_uniqueness_of :name, unless: User.where(name: :name).first.email.include?("placeholder@email.com")
What is the correct way to do this?