summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-04-06 21:57:04 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-04-06 21:57:46 +0200
commit57c353fca7121a120142161b253004f33d815766 (patch)
tree8585ef048a2bb138f9eca4c5e34874efd396a045 /app/models/project.rb
parent9d4b6f2261e8c1dc24949f19aab21850ab487b25 (diff)
downloadgitlab-ce-57c353fca7121a120142161b253004f33d815766.tar.gz
Fix tests and review
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4da0e016756..112209fef30 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -168,6 +168,8 @@ class Project < ActiveRecord::Base
has_many :environments, dependent: :destroy
has_many :deployments, dependent: :destroy
+ has_many :active_runners, -> { active }, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
+
accepts_nested_attributes_for :variables, allow_destroy: true
accepts_nested_attributes_for :project_feature
@@ -1096,20 +1098,12 @@ class Project < ActiveRecord::Base
@shared_runners ||= shared_runners_available? ? Ci::Runner.shared : Ci::Runner.none
end
- def active_runners
- @active_runners ||= runners.active
- end
-
def active_shared_runners
@active_shared_runners ||= shared_runners.active
end
def any_runners?(&block)
- if active_runners.any?(&block)
- return true
- end
-
- active_shared_runners.any?(&block)
+ active_runners.any?(&block) || active_shared_runners.any?(&block)
end
def valid_runners_token?(token)