2017-06-02 10:16:11 +00:00
|
|
|
module Ci
|
|
|
|
class Stage < ActiveRecord::Base
|
|
|
|
extend Ci::Model
|
2017-07-04 13:50:03 +00:00
|
|
|
include Importable
|
2017-07-04 13:31:15 +00:00
|
|
|
include HasStatus
|
|
|
|
|
|
|
|
enumerated_status!
|
2017-06-02 10:16:11 +00:00
|
|
|
|
|
|
|
belongs_to :project
|
|
|
|
belongs_to :pipeline
|
|
|
|
|
|
|
|
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id
|
|
|
|
has_many :builds, foreign_key: :commit_id
|
2017-07-04 13:50:03 +00:00
|
|
|
|
|
|
|
validates :project, presence: true, unless: :importing?
|
|
|
|
validates :pipeline, presence: true, unless: :importing?
|
|
|
|
validates :name, presence: true, unless: :importing?
|
2017-06-02 10:16:11 +00:00
|
|
|
end
|
|
|
|
end
|