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