summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 21:06:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 21:06:28 +0000
commit8f210aebe1d740e8ee194f171f1f33a6e1fba313 (patch)
treef43c545801bb96fd0737f18493fb30ab92972627 /app/models/environment.rb
parent996f700997805b3590da8d8afdd19d193989078a (diff)
downloadgitlab-ce-8f210aebe1d740e8ee194f171f1f33a6e1fba313.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index b426941d8af..602dce89c4a 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -10,6 +10,7 @@ class Environment < ApplicationRecord
has_many :successful_deployments, -> { success }, class_name: 'Deployment'
has_one :last_deployment, -> { success.order('deployments.id DESC') }, class_name: 'Deployment'
+ has_one :last_visible_deployment, -> { visible.distinct_on_environment }, class_name: 'Deployment'
before_validation :nullify_external_url
before_validation :generate_slug, if: ->(env) { env.slug.blank? }