Drop the need for access tokens to have a session

This commit is contained in:
David Heinemeier Hansson
2025-12-02 12:19:58 +01:00
committed by Stanko K.R.
parent 660fcff558
commit 895b0e13b8
8 changed files with 1 additions and 33 deletions
-8
View File
@@ -1,14 +1,6 @@
class Identity::AccessToken < ApplicationRecord
belongs_to :identity
belongs_to :session
has_secure_token
enum :permission, %w[ read write ].index_by(&:itself), default: :read
before_validation :build_session, on: :create
private
def build_session
self.session = identity.sessions.build(user_agent: "Access Token")
end
end