A bad words validator for Rails applications
Add this line to your application's Gemfile:
gem 'ratel', github: 'petlove/ratel'
You can use this gem in two ways:
- Using in active models validates
class Person
include ActiveModel::Validations
attr_accessor :name
validates :name, valid_text: true
#...
end
- Using the validator
Ratel::Validator.valid?('linqueta')
Will be raised this error when the value was invalid:
Person.new('cachorrao').validate!
# => ActiveModel::ValidationError: Validation failed: Name deve ser um valor válido
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Rails::Healthcheck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.