Chatwoot/app/models/concerns/access_tokenable.rb
Sojan Jose a5b1e2b650
Feature: Access tokens for API access (#604)
Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
2020-03-11 00:02:15 +05:30

11 lines
246 B
Ruby

module AccessTokenable
extend ActiveSupport::Concern
included do
has_one :access_token, as: :owner, dependent: :destroy
after_create :create_access_token
end
def create_access_token
AccessToken.create!(owner: self)
end
end