Add User#email_domain method to extract domain from email address (#35159)

This commit is contained in:
Matt Jankowski 2025-06-25 03:22:19 -04:00 committed by GitHub
commit f852da50f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 3 deletions

View file

@ -223,6 +223,12 @@ class User < ApplicationRecord
end
end
def email_domain
Mail::Address.new(email).domain
rescue Mail::Field::ParseError
nil
end
def update_sign_in!(new_sign_in: false)
old_current = current_sign_in_at
new_current = Time.now.utc