models: add deletable concern.

This commit is contained in:
evazion
2020-03-06 17:06:29 -06:00
parent 32bad825e1
commit 5bc0ab446b
13 changed files with 30 additions and 37 deletions

View File

@@ -15,9 +15,8 @@ class Dmail < ApplicationRecord
after_commit :send_email, on: :create
api_attributes including: [:key]
deletable
scope :active, -> { where(is_deleted: false) }
scope :deleted, -> { where(is_deleted: true) }
scope :read, -> { where(is_read: true) }
scope :unread, -> { where(is_read: false) }
scope :sent, -> { where("dmails.owner_id = dmails.from_id") }