54ec7e9599
1. Make the "subscribed" text in Issuable sidebar reflect the labels subscription status 2. Current user mut be logged-in to toggle issue/MR/label subscription
21 lines
540 B
Ruby
21 lines
540 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: subscriptions
|
|
#
|
|
# id :integer not null, primary key
|
|
# user_id :integer
|
|
# subscribable_id :integer
|
|
# subscribable_type :string(255)
|
|
# subscribed :boolean
|
|
# created_at :datetime
|
|
# updated_at :datetime
|
|
#
|
|
|
|
class Subscription < ActiveRecord::Base
|
|
belongs_to :user
|
|
belongs_to :subscribable, polymorphic: true
|
|
|
|
validates :user_id,
|
|
uniqueness: { scope: [:subscribable_id, :subscribable_type] },
|
|
presence: true
|
|
end
|