SUSE/hackweek

View on GitHub
app/models/notification.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Notification < ActiveRecord::Base
  belongs_to :recipient, class_name: 'User'
  belongs_to :actor, class_name: 'User'
  belongs_to :notifiable, polymorphic: true

  scope :unread, -> { where(read_at: nil) }
  scope :logged_in, ->(user) { where(recipient: user) }
end