diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-07-26 14:19:37 +0200 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-07-29 13:54:45 +0200 |
commit | 76e9b68439510af5c783a81b93944f1c8d96d150 (patch) | |
tree | 62f4dde6c0caa56aa9ebbbdd31df9a215767dc87 /app/models | |
parent | 84cd2120952e7ee4095cb4b5d7c959f2c11610c5 (diff) | |
download | gitlab-ce-76e9b68439510af5c783a81b93944f1c8d96d150.tar.gz |
Incorporate feedback
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/environment.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb index 9eff0fdab03..baed106e8c8 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -3,6 +3,8 @@ class Environment < ActiveRecord::Base has_many :deployments + before_validation :nullify_external_url + validates :name, presence: true, uniqueness: { scope: :project_id }, @@ -12,9 +14,15 @@ class Environment < ActiveRecord::Base validates :external_url, uniqueness: { scope: :project_id }, - length: { maximum: 255 } + length: { maximum: 255 }, + allow_nil: true, + addressable_url: true def last_deployment deployments.last end + + def nullify_external_url + self.external_url = nil if self.external_url.blank? + end end |