Simplify User.comment_notifiable scope

This commit is contained in:
Andrew Kvalheim 2022-03-31 17:30:50 -07:00
parent c9f410e68a
commit 9d4af0dcd3
4 changed files with 8 additions and 10 deletions

View file

@ -37,7 +37,7 @@ class User < ApplicationRecord
after_save :touch_events
# add scope
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference.id)}
scope :comment_notifiable, ->(conference_id) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference_id)}
# scopes for user distributions
scope :recent, lambda {