summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-18 19:34:10 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-18 19:34:10 +0800
commit62127dc95a28d6e7018a72c1a643dbf828a806d4 (patch)
tree29af38b74b3baf28829a50ddc6aa3186cee94e94 /app/models/project.rb
parent17d0406546885bedf2196c61a5991092b3fbe7c0 (diff)
parent2c1062f81e3c39cf8a45185c203995a43b91bf65 (diff)
downloadgitlab-ce-62127dc95a28d6e7018a72c1a643dbf828a806d4.tar.gz
Merge remote-tracking branch 'upstream/master' into artifacts-from-ref-and-build-name
* upstream/master: (359 commits) Add new image to show the 'Reset template' button Refactor description templates documentation Remove index from pipeline toggles Hide `Create new list button` on Issues and MRs pages Remove params from build; general refactor Style build container box; add check mark to active build Display jobs as scrolling list in sidebar Move stages and jobs to build sidebar Removed vue assets Move skipped tests to end of array Remove unused data attributes Update changelog Style build dropdowns Populate dropdowns with current build on pageload Selecting stage updates builds dropdown Add data attributes to builds Change active state of list items; style dropdown items Hide dropdown if all tests fit on one line; add counter to dropdown Add overflow tests to dropdown Order by build status ...
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 02342239ce0..678fca7afd1 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -62,6 +62,8 @@ class Project < ActiveRecord::Base
belongs_to :group, -> { where(type: Group) }, foreign_key: 'namespace_id'
belongs_to :namespace
+ has_one :board, dependent: :destroy
+
has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event', foreign_key: 'project_id'
# Project services
@@ -197,6 +199,8 @@ class Project < ActiveRecord::Base
scope :active, -> { joins(:issues, :notes, :merge_requests).order('issues.created_at, notes.created_at, merge_requests.created_at DESC') }
scope :abandoned, -> { where('projects.last_activity_at < ?', 6.months.ago) }
+ scope :excluding_project, ->(project) { where.not(id: project) }
+
state_machine :import_status, initial: :none do
event :import_start do
transition [:none, :finished] => :started