You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
456 B

  1. # frozen_string_literal: true
  2. module ApplicationExtension
  3. extend ActiveSupport::Concern
  4. included do
  5. validates :name, length: { maximum: 60 }
  6. validates :website, url: true, length: { maximum: 2_000 }, if: :website?
  7. validates :redirect_uri, length: { maximum: 2_000 }
  8. end
  9. def most_recently_used_access_token
  10. @most_recently_used_access_token ||= access_tokens.where.not(last_used_at: nil).order(last_used_at: :desc).first
  11. end
  12. end