def destroy_singular_notifications(klass)
klass.select('notify_user_notifications.*')
.from("notify_user_notifications, to_json(notify_user_notifications.params -> 'user') user_entry")
.where("user_entry ->> 'id' = ?", user.id).destroy_all
end
Need to be able to efficiently query on the subject of a notification, not just the target to whom the notification is sent. So that we can delete notifications for content that has been deleted or no longer warrants a notification.