Class: Ci::Trigger

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Model
Defined in:
app/models/ci/trigger.rb

Instance Method Summary collapse

Methods included from Model

model_name, table_name_prefix

Instance Method Details

#last_trigger_requestObject


32
33
34
# File 'app/models/ci/trigger.rb', line 32

def last_trigger_request
  trigger_requests.last
end

#last_usedObject


36
37
38
# File 'app/models/ci/trigger.rb', line 36

def last_used
  last_trigger_request.try(:created_at)
end

#set_default_valuesObject


28
29
30
# File 'app/models/ci/trigger.rb', line 28

def set_default_values
  self.token = SecureRandom.hex(15) if self.token.blank?
end

#short_tokenObject


40
41
42
# File 'app/models/ci/trigger.rb', line 40

def short_token
  token[0...10]
end