diff options
Diffstat (limited to 'app/models/service.rb')
-rw-r--r-- | app/models/service.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/service.rb b/app/models/service.rb index 9896aa12e90..93b8211651a 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -53,6 +53,10 @@ class Service < ApplicationRecord scope :deployment_hooks, -> { where(deployment_events: true, active: true) } scope :external_issue_trackers, -> { issue_trackers.active.without_defaults } scope :deployment, -> { where(category: 'deployment') } + scope :templates, -> { where(template: true) } + scope :available, -> (names = available_services_names) { + where(type: names.map { |name| "#{name}_service".camelize }) + } default_value_for :category, 'common' @@ -68,10 +72,6 @@ class Service < ApplicationRecord true end - def template? - template - end - def category read_attribute(:category).to_sym end @@ -299,7 +299,7 @@ class Service < ApplicationRecord end def self.find_by_template - find_by(template: true) + templates.first end private |