summaryrefslogtreecommitdiff
path: root/app/models/users_star_project.rb
blob: 9be6bd2e6f308db1d514a7f485d242ddfdf80536 (plain)
1
2
3
4
5
6
7
8
9
10
# frozen_string_literal: true

class UsersStarProject < ApplicationRecord
  belongs_to :project, counter_cache: :star_count, touch: true
  belongs_to :user

  validates :user, presence: true
  validates :user_id, uniqueness: { scope: [:project_id] }
  validates :project, presence: true
end