I have a User model, which has an email and a password field. For security, these may not be equal to each other. How can I define this in my model?
more fun:
validates :password, exclusion: { in: ->(person) { [person.email] }, message: "cannot use protected password" }
which might be even better in this case, since you could check for other forbidden values with something like
validates :password, exclusion: { in: ->(person) { [person.email, person.first_name, person.last_name, person.phone_number, person.department_name] }, message: "cannot use protected password" }