I am looking for a way in Rails (2.3.9) to PREVENT users from entering email addresses, and phone numbers of as many formats as possible. I have a textbox, and I do not want users to be able to submit email addresses or phone numbers..
Any ideas开发者_Go百科?
Probably the most straightforward method would be to use a custom validation with validate. You can check against the regexes you want to prevent users from submitting and supply your own validation message.
I've created a gist demonstrating this behavior.
精彩评论