Skip to content

Commit

Permalink
Clarify how multiple rules work
Browse files Browse the repository at this point in the history
  • Loading branch information
koppen committed Dec 3, 2024
1 parent daed02a commit 2cfc794
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ Or you could go beyound simple matching and validate that all email adresses bel
:with => proc { |address| address.end_with?("@substancelab.com") }
}

You can even match against multiple rules, in which case all rules must pass:

validates :email, :email_address => {
:with => [
proc { |address| address.match(/.+@.+\..+/) },
proc { |address| !address.end_with?("@outlook.com") },
]
}

Do note that supplying your own rules means that the default email address validation isn't run - you're on your own, basically.

### Verify domain (still to be done - pull request, anybody?)

This also checks that the domain actually has an MX record. Note this might take a while because of DNS lookups.
Expand Down

0 comments on commit 2cfc794

Please sign in to comment.