Skip to content

Commit 236ad8f

Browse files
committed
Merge pull request #2 from VentureSpirit/allow-subdomains
Added a fix for nil domain.
2 parents 2fcf2be + 712aa8a commit 236ad8f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/email_domain_inclusion.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ def validate_each(record, attribute, value)
1414
private
1515
def valid_subdomain?(value)
1616
domain = domain_from_email(value)
17+
return false unless domain
1718
allowed_domains.any? { |allowed_domain| domain.end_with? ".#{allowed_domain}" }
1819
end
1920

2021
def valid_full_domain?(value)
2122
domain = domain_from_email(value)
23+
return false unless domain
2224
allowed_domains.include?(domain)
2325
end
2426

0 commit comments

Comments
 (0)