Smooth out the finder API

This commit is contained in:
David Heinemeier Hansson
2025-12-02 12:47:00 +01:00
committed by Stanko K.R.
parent 0ba43de61a
commit caa4cd491e
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -14,6 +14,10 @@ class Identity < ApplicationRecord
validates :email_address, format: { with: URI::MailTo::EMAIL_REGEXP }
normalizes :email_address, with: ->(value) { value.strip.downcase.presence }
def self.find_by_access_token(token)
AccessToken.find_by(token: token)&.identity
end
def send_magic_link(**attributes)
attributes[:purpose] = attributes.delete(:for) if attributes.key?(:for)