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