From 865e8853369b542569693ec23a9b533481228829 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Sat, 14 May 2016 14:47:47 -0500 Subject: [PATCH] Fix specs for MySQL --- app/models/ci/commit.rb | 5 ++--- app/views/projects/pipelines/index.html.haml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 91c5b4c1cae..6675a3f5d53 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -8,8 +8,6 @@ module Ci has_many :builds, class_name: 'Ci::Build' has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest' - delegate :stages, to: :statuses - validates_presence_of :sha validates_presence_of :status validate :valid_commit_sha @@ -22,7 +20,8 @@ module Ci end def self.stages - CommitStatus.where(commit: all).stages + # We use pluck here due to problems with MySQL which doesn't allow LIMIT/OFFSET in queries + CommitStatus.where(commit: pluck(:id)).stages end def project_id diff --git a/app/views/projects/pipelines/index.html.haml b/app/views/projects/pipelines/index.html.haml index 574941ed5f2..af55ef42a6e 100644 --- a/app/views/projects/pipelines/index.html.haml +++ b/app/views/projects/pipelines/index.html.haml @@ -55,7 +55,7 @@ %tbody %th ID %th Commit - - @pipelines.stages.each do |stage| + - stages.each do |stage| %th %span.has-tooltip(title="#{stage.titleize}") = truncate(stage.titleize.pluralize, length: 8) -- GitLab