Git Product home page Git Product logo

validates_email_format_of's Introduction

Validates email format

Validate various formats of email address against RFC 2822.

Usage

class PersonTest < ActiveSupport::TestCase
  should_validate_email_format_of :email
end

class Person < ActiveRecord::Base
  validates_email_format_of :email
end

Options

:message =>
  String. A custom error message (default is: " does not appear to be a valid e-mail address")

:on =>
  Symbol. Specifies when this validation is active (default is :save, other options :create, :update)

:allow_nil =>
  Boolean. Allow nil values (default is false)

:allow_blank =>
  Boolean. Allow blank values (default is false)

:if =>
  Specifies a method, proc or string to call to determine if the validation should occur 
  (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The method, 
  proc or string should return or evaluate to a true or false value. 

:unless =>
  See :if option.

Testing

To execute the unit tests run rake test.

The unit tests for this plugin use an in-memory sqlite3 database.

Installing the gem

  • gem sources -a http://gems.github.com (only needed once)
  • sudo gem install dancroak-validates_email_format_of

Credits

Written by Alex Dunae (dunae.ca), 2006-07.

Thanks to Francis Hwang (http://fhwang.net/) at Diversion Media for creating the 1.1 update.

validates_email_format_of's People

Contributors

technicalpickles avatar mike-burns avatar lsegal avatar qrush avatar

Stargazers

Aleksey Dmitriev avatar

Watchers

Aleksey Dmitriev avatar James Cloos avatar  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.