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

class UsersStarProject < ActiveRecord::Base
  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