2016-07-27 15:32:32 -04:00
|
|
|
class Board < ActiveRecord::Base
|
|
|
|
belongs_to :project
|
|
|
|
|
2017-06-08 11:16:27 -04:00
|
|
|
has_many :lists, -> { order(:list_type, :position) }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
|
2016-07-27 15:32:32 -04:00
|
|
|
|
2017-08-28 17:56:49 -04:00
|
|
|
validates :project, presence: true, if: :project_needed?
|
|
|
|
|
|
|
|
def project_needed?
|
|
|
|
true
|
|
|
|
end
|
2016-09-26 13:39:41 -04:00
|
|
|
|
2017-08-31 15:34:57 -04:00
|
|
|
def parent
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
def group_board?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2017-05-31 07:34:54 -04:00
|
|
|
def backlog_list
|
|
|
|
lists.merge(List.backlog).take
|
|
|
|
end
|
|
|
|
|
2017-03-24 08:40:35 -04:00
|
|
|
def closed_list
|
|
|
|
lists.merge(List.closed).take
|
2016-09-26 13:39:41 -04:00
|
|
|
end
|
2016-07-27 15:32:32 -04:00
|
|
|
end
|