2014-06-26 07:49:14 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: users_star_projects
|
|
|
|
#
|
2014-08-25 09:25:02 +00:00
|
|
|
# id :integer not null, primary key
|
|
|
|
# project_id :integer not null
|
|
|
|
# user_id :integer not null
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
2014-06-26 07:49:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
class UsersStarProject < ActiveRecord::Base
|
2015-12-01 20:11:12 +00:00
|
|
|
belongs_to :project, counter_cache: :star_count, touch: true
|
2014-06-26 07:49:14 +00:00
|
|
|
belongs_to :user
|
|
|
|
|
|
|
|
validates :user, presence: true
|
|
|
|
validates :user_id, uniqueness: { scope: [:project_id] }
|
|
|
|
validates :project, presence: true
|
|
|
|
end
|