blob: 0dce146b7a9ec2d9b2147c5f8bc9e747885b4cee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
class NotificationSetting < ActiveRecord::Base
belongs_to :user
belongs_to :source, polymorphic: true
validates :user, presence: true
validates :source, presence: true
validates :level, presence: true
validates :user_id, uniqueness: { scope: [:source_type, :source_id],
message: "already exists in source",
allow_nil: true }
# Notification level
# Note: When adding an option, it MUST go on the end of the array.
enum level: [:disabled, :participating, :watch, :global, :mention]
end
|