board.rb 401 Bytes
Newer Older
1 2 3
class Board < ActiveRecord::Base
  belongs_to :project

4
  has_many :lists, -> { order(:list_type, :position) }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
5

Felipe's avatar
Felipe committed
6 7 8 9 10
  validates :project, presence: true, if: :project_needed?

  def project_needed?
    true
  end
11

12 13 14 15
  def backlog_list
    lists.merge(List.backlog).take
  end

16 17
  def closed_list
    lists.merge(List.closed).take
18
  end
19
end