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