gitlab-org--gitlab-foss/app/models/users_star_project.rb
Dmitriy Zaporozhets 92deb451da
Annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-08-25 12:25:02 +03:00

19 lines
497 B
Ruby

# == Schema Information
#
# Table name: users_star_projects
#
# id :integer not null, primary key
# project_id :integer not null
# user_id :integer not null
# created_at :datetime
# updated_at :datetime
#
class UsersStarProject < ActiveRecord::Base
belongs_to :project, counter_cache: :star_count
belongs_to :user
validates :user, presence: true
validates :user_id, uniqueness: { scope: [:project_id] }
validates :project, presence: true
end