in my app, I allow users to create a handle.
user.rb (:handle)
What I would like to do is have a blacklist of words that can not be used, like “support”, “staff”, bad words etc…
Is that possible using a validates method in the rails model?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, there is validates_exclusion_of
http://ar.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M000089
Disadvantage: it is sensitive to case, so “bad” and “Bad” are different words.