summaryrefslogtreecommitdiff
path: root/app/models/board.rb
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2018-03-21 18:26:06 +0000
committerLuke Bennett <lukeeeebennettplus@gmail.com>2018-03-21 18:26:06 +0000
commit2bb3e4c6e389915d2702ffcfaff5d31b6a41f582 (patch)
treeda71c857eee52a4f9ac4705ca3f06c9ec7dd9384 /app/models/board.rb
parent5595afe807c3c11d9c695c558da1210a25544387 (diff)
parent9027d023a58c8ac803bc114c6213b1f124a978a2 (diff)
downloadgitlab-ce-2bb3e4c6e389915d2702ffcfaff5d31b6a41f582.tar.gz
Merge remote-tracking branch 'origin/master' into deprecation-warning-for-dynamic-milestones
Diffstat (limited to 'app/models/board.rb')
-rw-r--r--app/models/board.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/board.rb b/app/models/board.rb
index 5bb7d3d3722..3cede6fc99a 100644
--- a/app/models/board.rb
+++ b/app/models/board.rb
@@ -1,20 +1,22 @@
class Board < ActiveRecord::Base
+ belongs_to :group
belongs_to :project
has_many :lists, -> { order(:list_type, :position) }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
validates :project, presence: true, if: :project_needed?
+ validates :group, presence: true, unless: :project
def project_needed?
- true
+ !group
end
def parent
- project
+ @parent ||= group || project
end
def group_board?
- false
+ group_id.present?
end
def backlog_list