debian-mirror-gitlab/app/models/users_star_project.rb

20 lines
510 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
# == Schema Information
#
# Table name: users_star_projects
#
2015-04-26 12:48:37 +05:30
# id :integer not null, primary key
# project_id :integer not null
# user_id :integer not null
# created_at :datetime
# updated_at :datetime
2014-09-02 18:07:02 +05:30
#
class UsersStarProject < ActiveRecord::Base
2015-12-23 02:04:40 +05:30
belongs_to :project, counter_cache: :star_count, touch: true
2014-09-02 18:07:02 +05:30
belongs_to :user
validates :user, presence: true
validates :user_id, uniqueness: { scope: [:project_id] }
validates :project, presence: true
end