refactors email digest

This commit is contained in:
rgarcia
2016-08-03 19:33:37 +02:00
parent 6281af2a7d
commit b087fe8fb7
4 changed files with 26 additions and 13 deletions

View File

@@ -2,9 +2,11 @@ class Notification < ActiveRecord::Base
belongs_to :user, counter_cache: true
belongs_to :notifiable, polymorphic: true
scope :unread, -> { all }
scope :recent, -> { order(id: :desc) }
scope :for_render, -> { includes(:notifiable) }
scope :unread, -> { all }
scope :recent, -> { order(id: :desc) }
scope :not_emailed, -> { where(emailed_at: nil) }
scope :for_render, -> { includes(:notifiable) }
def timestamp
notifiable.created_at