app/models/support_subscription.rb in help_center-0.0.5 vs app/models/support_subscription.rb in help_center-0.0.6
- old
+ new
@@ -1,19 +1,19 @@
-class SupportSubscription < ApplicationRecord
- belongs_to :support_thread
- belongs_to :user
-
- scope :optin, ->{ where(subscription_type: :optin) }
- scope :optout, ->{ where(subscription_type: :optout) }
-
- validates :subscription_type, presence: true, inclusion: { in: %w{ optin optout } }
- validates :user_id, uniqueness: { scope: :support_thread_id }
-
- def toggle!
- case subscription_type
- when "optin"
- update(subscription_type: "optout")
- when "optout"
- update(subscription_type: "optin")
- end
- end
-end
+class SupportSubscription < ApplicationRecord
+ belongs_to :support_thread
+ belongs_to :user
+
+ scope :optin, ->{ where(subscription_type: :optin) }
+ scope :optout, ->{ where(subscription_type: :optout) }
+
+ validates :subscription_type, presence: true, inclusion: { in: %w{ optin optout } }
+ validates :user_id, uniqueness: { scope: :support_thread_id }
+
+ def toggle!
+ case subscription_type
+ when "optin"
+ update(subscription_type: "optout")
+ when "optout"
+ update(subscription_type: "optin")
+ end
+ end
+end