Module: ActiveModel::Validations::HelperMethods
- Defined in:
- lib/validates_not_profane.rb
Instance Method Summary collapse
-
#validates_not_profane(*attr_names) ⇒ Object
Validates whether the value of the specified attributes contain profanity.
Instance Method Details
#validates_not_profane(*attr_names) ⇒ Object
Validates whether the value of the specified attributes contain profanity
class Comment < ActiveRecord::Base
validates_not_profane :body
end
Configuration options:
-
:message
- A custom error message (default is: “must not contain any vulgar words”). -
:tolerance
- Tolerance for Profanalyzer -
:sexual
- Whether to check for sexual words -
:racist
- Whether to check for racial slurs -
:all
- Whether to check all bad words
58 59 60 |
# File 'lib/validates_not_profane.rb', line 58 def validates_not_profane(*attr_names) validates_with ProfanityValidator, _merge_attributes(attr_names) end |