application_extension.rb 496 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. module ApplicationExtension
  3. extend ActiveSupport::Concern
  4. included do
  5. has_many :created_users, class_name: 'User', foreign_key: 'created_by_application_id', inverse_of: :created_by_application
  6. validates :name, length: { maximum: 60 }
  7. validates :website, url: true, length: { maximum: 2_000 }, if: :website?
  8. validates :redirect_uri, length: { maximum: 2_000 }
  9. end
  10. def confirmation_redirect_uri
  11. redirect_uri.lines.first.strip
  12. end
  13. end