Refer to constant values from api/v1/apps
request spec (#33488)
This commit is contained in:
parent
7ad44e22ed
commit
b3243ef41c
3 changed files with 25 additions and 6 deletions
|
@ -3,14 +3,18 @@
|
|||
module ApplicationExtension
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
APP_NAME_LIMIT = 60
|
||||
APP_REDIRECT_URI_LIMIT = 2_000
|
||||
APP_WEBSITE_LIMIT = 2_000
|
||||
|
||||
included do
|
||||
include Redisable
|
||||
|
||||
has_many :created_users, class_name: 'User', foreign_key: 'created_by_application_id', inverse_of: :created_by_application
|
||||
|
||||
validates :name, length: { maximum: 60 }
|
||||
validates :website, url: true, length: { maximum: 2_000 }, if: :website?
|
||||
validates :redirect_uri, length: { maximum: 2_000 }
|
||||
validates :name, length: { maximum: APP_NAME_LIMIT }
|
||||
validates :redirect_uri, length: { maximum: APP_REDIRECT_URI_LIMIT }
|
||||
validates :website, url: true, length: { maximum: APP_WEBSITE_LIMIT }, if: :website?
|
||||
|
||||
# The relationship used between Applications and AccessTokens is using
|
||||
# dependent: delete_all, which means the ActiveRecord callback in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue