Is it possible to use validates_exclusion_of with regular expressions?
That would ensure that URLs matching these specific patterns can’t be validated nor inserted into db.
What would be the best approach to code this?
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.
There are a couple ways I might do it, depending on the circumstance.
First, if I am going to have to match some patterns and then exclude others I might do something like this:
Or if you just need to exclude certain patterns
resources: http://apidock.com/rails/ActiveModel/Validations/ClassMethods/validate