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