Project

antivirus

0.0
No commit activity in last 3 years
No release in over 3 years
Profanity filter for Rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

>= 0
 Project Readme

Antivirus

Build Status Gem Version

Antivirus provides a validator which filter profane words for Rails application.

Installation

Add this line to your application's Gemfile:

gem 'antivirus'

And then execute:

$ bundle

Usage

Define profane words as array in config/locales/*.yml with antivirus.profane_words key.

antivirus.message key is an error message when value includes profane words.

en:
  antivirus:
    message: includes profane words.
    profane_words:
      - foo
      - bar
      - baz

For example, Post model exists like this:

class Post < ActiveRecord::Base
  validates :content, profanity_filter: true
end

In this case, post can't include profane words.

post = Post.create(content: 'foo')

post.valid?
#=> false

post.errors.full_messages
#=> ["Content includes profane words."]

Contributing

  1. Fork it ( https://github.com/kami-zh/antivirus/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request