gitlab-org--gitlab-foss/app/models/board.rb
Lin Jen-Shin 6b43e8e636 Unify app/views/shared/issuable/_search_bar.html.haml
This brings some EE changes which don't hurt
2018-07-05 17:27:30 +08:00

33 lines
608 B
Ruby

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?
!group
end
def parent
@parent ||= group || project
end
def group_board?
group_id.present?
end
def backlog_list
lists.merge(List.backlog).take
end
def closed_list
lists.merge(List.closed).take
end
def scoped?
false
end
end