gitlab-org--gitlab-foss/app/models/personal_access_token.rb
2016-04-28 22:28:36 +05:30

16 lines
345 B
Ruby

class PersonalAccessToken < ActiveRecord::Base
belongs_to :user
scope :active, -> { where.not(revoked: true) }
def self.generate(params)
personal_access_token = self.new(params)
personal_access_token.token = Devise.friendly_token(50)
personal_access_token
end
def revoke!
self.revoked = true
self.save
end
end