Class: Spina::Shop::InStockReminderJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- Spina::Shop::InStockReminderJob
- Defined in:
- app/jobs/spina/shop/in_stock_reminder_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(orderable) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/jobs/spina/shop/in_stock_reminder_job.rb', line 4 def perform(orderable) if orderable.in_stock? orderable.in_stock_reminders.pluck(:email).compact.uniq.each do |email| InStockReminderMailer.reminder(email, orderable).deliver_later end # Delete all reminders because we just sent them # Efficient but won't trigger callbacks orderable.in_stock_reminders.delete_all end end |