Repository is archived
No commit activity in last 3 years
No release in over 3 years
ActiveRecord model validation against stopforumspam.com (Rails 3)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

> 3.0
 Project Readme

= 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.