Noticed V2 how to joins(:events)
Fearing this will run shivers of back in kindergarden I do apologize in advance for asking this level of n00b-ness question but I simply cannot wriggle my head around the Noticed::Notification (noticed_notifications) and Noticed::Event (noticed_events) models (tables) in my quest for distilling the number of notifications (delivered by TaskNotifier) users have received pertaining to tasks :(
I'm leaning towards Current.user.notifications.joins(:something).where(something: { record_type: "Task" } )
but sadly no matter what combo of events, noticed, more, I use all I get back is some flavour of #<ActiveRecord::ConfigurationError: Can't join 'Noticed::Notification' to association named 'noticed_events';
I'll let myself out!
Current.user.tasks.first_tasks.uncompleted.each do |task|
task.notify unless task.notifications.where( recipient: Current.user).any?
end
- and I am aware of the "less than optimal" solution (eg with a few hundred users each with a couple dozen tasks this sick monster will run for years on end) :sunglasses: