GithubHelp home page GithubHelp logo

musajoemo / validates_against_stopforumspam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rfc2822/validates_against_stopforumspam

0.0 2.0 0.0 86 KB

ActiveRecord validation for comment models against stopforumspam.com

License: MIT License

validates_against_stopforumspam's Introduction

= ValidatesAgainstStopForumSpam

Rails gem for ActiveRecord comment model validation against StopForumSpam.com. No API key required.

Respect their terms of use: http://www.stopforumspam.com/apis

Compatibility: Rails 3, tested with Ruby 1.9.3

Licensed under MIT license.

Installation

Specify the gem in your Gemfile:

	gem "validates_against_stopforumspam"

or for the current edge version:

	gem "validates_against_stopforumspam", :git => 'git://github.com/rfc2822/validates_against_stopforumspam'

and install it with bundler.

Usage

validates_against_stopforumspam processes three parameters:

  • username
  • email
  • ip

If your model's attribute names are different, you can specify the names in the validates_against_stopforumspam call. If an attribute is not present, it will be ignored.

	class Comment < ActiveRecord::Base
		validates_against_stopforumspam :username => :user_name
	end

You may also pass other parameters for validate:

	class Comment < ActiveRecord::Base
		validates_against_stopforumspam :username => :user_name, :ip => :ip_address, :on => :create
	end

When the comment may be spam (because at least one of the parameters appear on stopforumspam.com), the validation error :spam_according_to_stopforumspam is added to the model instance. Translate it in your i18n files.

validates_against_stopforumspam's People

Contributors

rfc2822 avatar

Watchers

James Cloos avatar John Moore avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.