blob: ac3a571a1f3aa12f1a9209de40e124190354c788 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
class Environment < ActiveRecord::Base
belongs_to :project, required: true, validate: true
has_many :deployments
validates :name,
presence: true,
uniqueness: { scope: :project_id },
length: { within: 0..255 },
format: { with: Gitlab::Regex.environment_name_regex,
message: Gitlab::Regex.environment_name_regex_message }
def last_deployment
deployments.last
end
end
|