diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-09-28 16:33:19 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-09-29 11:47:04 +0300 |
commit | 0fa4ab5fd8e0cb775ff4fe75d011ff717f0b3945 (patch) | |
tree | ecfe84f8c11e4aca4643570dff1f31eb91ff50f7 /app/models | |
parent | e60647f011e30c215dfe596e079c616545071732 (diff) |
Rename commits to ci_commits
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/project.rb | 10 | ||||
-rw-r--r-- | app/models/project.rb | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/app/models/ci/project.rb b/app/models/ci/project.rb index ba6e320426c..77cce261fc8 100644 --- a/app/models/ci/project.rb +++ b/app/models/ci/project.rb @@ -48,8 +48,6 @@ module Ci accepts_nested_attributes_for :variables, allow_destroy: true - delegate :commits, :builds, to: :gl_project - # # Validations # @@ -210,5 +208,13 @@ module Ci def setup_finished? commits.any? end + + def commits + gl_project.ci_commits + end + + def builds + gl_project.ci_builds + end end end diff --git a/app/models/project.rb b/app/models/project.rb index a5393d396f8..d9334adef78 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -118,8 +118,8 @@ class Project < ActiveRecord::Base has_many :deploy_keys, through: :deploy_keys_projects has_many :users_star_projects, dependent: :destroy has_many :starrers, through: :users_star_projects, source: :user - has_many :commits, ->() { order('CASE WHEN ci_commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) }, dependent: :destroy, class_name: 'Ci::Commit', foreign_key: :gl_project_id - has_many :builds, through: :commits, dependent: :destroy, class_name: 'Ci::Build' + has_many :ci_commits, ->() { order('CASE WHEN ci_commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) }, dependent: :destroy, class_name: 'Ci::Commit', foreign_key: :gl_project_id + has_many :ci_builds, through: :ci_commits, source: :builds, dependent: :destroy, class_name: 'Ci::Build' has_one :import_data, dependent: :destroy, class_name: "ProjectImportData" has_one :gitlab_ci_project, dependent: :destroy, class_name: "Ci::Project", foreign_key: :gitlab_id |