blob: 32799ee27e63dde3118bf38fffc23ea80f410276 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
class Deployment < ActiveRecord::Base
include InternalId
belongs_to :project
belongs_to :environment
belongs_to :user
belongs_to :deployable, polymorphic: true
validates_presence_of :sha
validates_presence_of :ref
validates_associated :project
validates_associated :environment
delegate :name, to: :environment, prefix: true
def commit
project.commit(sha)
end
def commit_title
commit.try(:title)
end
def short_sha
Commit::truncate_sha(sha)
end
def last?
self == environment.last_deployment
end
end
|