2020-03-10 18:32:15 +00:00
|
|
|
module AccessTokenable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
2021-11-18 05:02:29 +00:00
|
|
|
has_one :access_token, as: :owner, dependent: :destroy_async
|
2020-03-10 18:32:15 +00:00
|
|
|
after_create :create_access_token
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_access_token
|
|
|
|
AccessToken.create!(owner: self)
|
|
|
|
end
|
|
|
|
end
|