BigW Consortium Gitlab

trigger_request.rb 588 Bytes
Newer Older
1 2 3
module Ci
  class TriggerRequest < ActiveRecord::Base
    extend Ci::Model
4

5 6 7
    belongs_to :trigger
    belongs_to :pipeline, foreign_key: :commit_id
    has_many :builds
8

Shinya Maeda committed
9
    # We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
10 11 12
    # Ci::TriggerRequest doesn't save variables anymore.
    validates :variables, absence: true

13
    serialize :variables # rubocop:disable Cop/ActiveRecordSerialize
14 15 16 17 18 19 20 21

    def user_variables
      return [] unless variables

      variables.map do |key, value|
        { key: key, value: value, public: false }
      end
    end
22 23
  end
end