No commit activity in last 3 years
No release in over 3 years
Rails 2 and Rails 3 plugin. Validates e-mail address format (RFC2822 and RFC3696) and whitelist/blacklist the domain part.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.3.11
~> 2.4.0
 Project Readme

validates_email_whitelist_of

Plugin for ActiveRecord for validating email format and whitelisting the domain.

Works on Rails 2+, Rails 3+ and Ruby 1.8+.

Usage

Add the gem to your Rails Gemfile

gem 'validates_email_whitelist_of'

Then on ActiveRecord 2.0+ you can do

class User < ActiveRecord::Base
  validates_email_whitelist_of :email, :whitelist => ['example.com', 'google.com']

validates_email_blacklist_of :email, :blacklist => ['123.com']
end

On ActiveRecord 3.0+ you can do

class User < ActiveRecord::Base
  validates :email, :whitelist => ['example.com', 'google.com']
validates :email, :blacklist => ['123.com']
end

If you want to use I18n, make sure you add the scope

activerecord.errors.messages.invalid_email activerecord.errors.messages.invalid_whitelist activerecord.errors.messages.invalid_blacklist

or

errors.messages.invalid_email errors.messages.invalid_whitelist errors.messages.invalid_blacklist

The following locales are builtin:

  • pt
  • pt-BR
  • en

Copyright (c) 2011 Ruben Fonseca, released under the MIT license