2018-10-26 08:49:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Tracks which boards in a specific project a user has visited
|
2019-03-28 09:17:42 -04:00
|
|
|
class BoardProjectRecentVisit < ApplicationRecord
|
2021-05-11 11:10:20 -04:00
|
|
|
include BoardRecentVisit
|
|
|
|
|
2018-10-26 08:49:16 -04:00
|
|
|
belongs_to :user
|
|
|
|
belongs_to :project
|
|
|
|
belongs_to :board
|
|
|
|
|
2021-05-11 11:10:20 -04:00
|
|
|
validates :user, presence: true
|
2018-10-26 08:49:16 -04:00
|
|
|
validates :project, presence: true
|
|
|
|
validates :board, presence: true
|
|
|
|
|
2021-05-11 11:10:20 -04:00
|
|
|
scope :by_user_parent, -> (user, project) { where(user: user, project: project) }
|
2019-02-27 08:08:48 -05:00
|
|
|
|
2021-05-11 11:10:20 -04:00
|
|
|
def self.board_parent_relation
|
|
|
|
:project
|
2018-10-26 08:49:16 -04:00
|
|
|
end
|
|
|
|
end
|