summaryrefslogtreecommitdiff
path: root/app/controllers/builds_controller.rb
diff options
context:
space:
mode:
authorKestred <kestred@riotcave.com>2014-08-23 22:27:52 -0700
committerKestred <kestred@riotcave.com>2014-08-23 22:27:52 -0700
commit18f954b31c242822b6c7430a50ca99a93adc6ea6 (patch)
treeb7ee4acac738d5b64b6fcfaf909756f784dd2d61 /app/controllers/builds_controller.rb
parent2eb3d91e1a6e51d3ca0be2fe0a5df750708b366d (diff)
downloadgitlab-ci-18f954b31c242822b6c7430a50ca99a93adc6ea6.tar.gz
Separate Commit model and logic from Build model|etc...
This is an entirely non-user facing change which prepares GitLab CI for future support of Parallel Builds. See https://about.gitlab.com/2013/12/19/gitlab-ci-with-parallel-builds-and-deployments/. These changes specifically avoid changing the supported API or changing any of the website views. Changes to the website views will come in tandem with future features like "Multiple build scripts". The supported API won't change as part of any future changes on this vein, to maintain support for the unofficial GitLab CI runners. This closes the following implementation step: 1. A commit has many builds Signed-off-by: Kestred <kestred@riotcave.com>
Diffstat (limited to 'app/controllers/builds_controller.rb')
-rw-r--r--app/controllers/builds_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/builds_controller.rb b/app/controllers/builds_controller.rb
index 79054a2..25b921e 100644
--- a/app/controllers/builds_controller.rb
+++ b/app/controllers/builds_controller.rb
@@ -20,7 +20,7 @@ class BuildsController < ApplicationController
raise ActiveRecord::RecordNotFound unless @build
- @builds = project.builds.where(sha: @build.sha).order('id DESC')
+ @builds = @project.commits.find_by_sha(@build.sha).builds.order('id DESC')
@builds = @builds.where("id not in (?)", @build.id).page(params[:page]).per(20)
respond_to do |format|
@@ -35,7 +35,7 @@ class BuildsController < ApplicationController
build = project.builds.create(
sha: @build.sha,
before_sha: @build.before_sha,
- push_data: @build.push_data,
+ push_data: @build.commit.push_data,
ref: @build.ref
)
@@ -65,6 +65,6 @@ class BuildsController < ApplicationController
end
def build_by_sha
- project.builds.where(sha: params[:id]).last
+ @project.commits.find_by_sha(sha: params[:id]).try(:last_build)
end
end