diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2015-12-14 10:32:57 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2015-12-14 10:32:57 +0000 |
commit | e81ae1e68c03de4442265e4699710421e2f2755c (patch) | |
tree | c3af812b5a8e8dbb3637370550550de777e53b36 /app/models/service.rb | |
parent | c80f34257dc389369801eb112506706d46051bb1 (diff) | |
parent | a0c2a7b0cbb4567a1f09c4cbc400bf75df47a072 (diff) | |
download | gitlab-ce-e81ae1e68c03de4442265e4699710421e2f2755c.tar.gz |
Merge branch 'ci-services-migrate' into 'master'
Ci Services migrate
See merge request !1985
Diffstat (limited to 'app/models/service.rb')
-rw-r--r-- | app/models/service.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/service.rb b/app/models/service.rb index d610abd1683..4159e367d8c 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -30,6 +30,7 @@ class Service < ActiveRecord::Base default_value_for :merge_requests_events, true default_value_for :tag_push_events, true default_value_for :note_events, true + default_value_for :build_events, true after_initialize :initialize_properties @@ -47,6 +48,7 @@ class Service < ActiveRecord::Base scope :issue_hooks, -> { where(issues_events: true, active: true) } scope :merge_request_hooks, -> { where(merge_requests_events: true, active: true) } scope :note_hooks, -> { where(note_events: true, active: true) } + scope :build_hooks, -> { where(build_events: true, active: true) } def activated? active @@ -133,6 +135,21 @@ class Service < ActiveRecord::Base end end + # Provide convenient boolean accessor methods + # for each serialized property. + # Also keep track of updated properties in a similar way as ActiveModel::Dirty + def self.boolean_accessor(*args) + self.prop_accessor(*args) + + args.each do |arg| + class_eval %{ + def #{arg}? + ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(#{arg}) + end + } + end + end + # Returns a hash of the properties that have been assigned a new value since last save, # indicating their original values (attr => original value). # ActiveRecord does not provide a mechanism to track changes in serialized keys, @@ -163,6 +180,7 @@ class Service < ActiveRecord::Base assembla bamboo buildkite + builds_email campfire custom_issue_tracker drone_ci |