Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/agent_token.rb')
-rw-r--r--app/models/clusters/agent_token.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/clusters/agent_token.rb b/app/models/clusters/agent_token.rb
index b260822f784..9d79887b574 100644
--- a/app/models/clusters/agent_token.rb
+++ b/app/models/clusters/agent_token.rb
@@ -7,9 +7,12 @@ module Clusters
self.table_name = 'cluster_agent_tokens'
- belongs_to :agent, class_name: 'Clusters::Agent'
+ belongs_to :agent, class_name: 'Clusters::Agent', optional: false
belongs_to :created_by_user, class_name: 'User', optional: true
before_save :ensure_token
+
+ validates :description, length: { maximum: 1024 }
+ validates :name, presence: true, length: { maximum: 255 }, on: :create
end
end