I want to add some validation to my ruby site, and I want to stop my
users putting in certain words for example dugs or stolen. I know ruby
has validation commands and I was wondering if there was one for textbox
input or would I have to make my own?
You could add something like an observer to your form input constantly
checking for bad words, but that would be costly for large input fields
and wouldn't catch someone feeding data to the action receiving the form
data directly.
These things are best put into the model. Say you had a model Advert
with attribute "body" which you wanted to protect, then use:
I want to add some validation to my ruby site, and I want to stop my
users putting in certain words for example dugs or stolen. I know ruby
has validation commands and I was wondering if there was one for textbox
input or would I have to make my own?
You could add something like an observer to your form input constantly
checking for bad words, but that would be costly for large input fields
and wouldn't catch someone feeding data to the action receiving the form
data directly.
These things are best put into the model. Say you had a model Advert
with attribute "body" which you wanted to protect, then use: