Module: OTP::JWT::ActiveRecord
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/otp/jwt/active_record.rb
Overview
- ActiveRecord
-
concern.
Instance Method Summary collapse
-
#to_jwt(claims = nil) ⇒ ActiveRecord::Base
Returns a [JWT] token for this record.
Instance Method Details
#to_jwt(claims = nil) ⇒ ActiveRecord::Base
Returns a [JWT] token for this record
40 41 42 43 44 45 |
# File 'lib/otp/jwt/active_record.rb', line 40 def to_jwt(claims = nil) OTP::JWT::Token.sign( sub: self.send(self.class.primary_key), **(claims || {}) ) end |