From 992f1d23a1f114e2e6638367b55870e94d663e87 Mon Sep 17 00:00:00 2001 From: voodoorai2000 Date: Thu, 25 Apr 2019 17:32:15 +0200 Subject: [PATCH] Change syntax to delay dashboard emails After updating to Rails5 It seems the after_action[1] in the dashboard's mailer is not beind called. Using this syntax the emails are still being delayed and the after_action being called correctly. [1] https://github.com/AyuntamientoMadrid/consul/pull/1945/files#diff-fdf5590f3241c439fcc9d2225c3cf4d8R3 --- app/models/proposal.rb | 4 ++-- lib/tasks/dashboards.rake | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 7eb397d3f..dd72d5173 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -241,7 +241,7 @@ class Proposal < ApplicationRecord new_actions = Dashboard::Action.detect_new_actions_since(Date.yesterday, self) if new_actions.present? - Dashboard::Mailer.new_actions_notification_on_create(self).deliver_later + Dashboard::Mailer.delay.new_actions_notification_on_create(self) end end @@ -249,7 +249,7 @@ class Proposal < ApplicationRecord new_actions_ids = Dashboard::Action.detect_new_actions_since(Date.yesterday, self) if new_actions_ids.present? - Dashboard::Mailer.new_actions_notification_on_published(self, new_actions_ids).deliver_later + Dashboard::Mailer.delay.new_actions_notification_on_published(self, new_actions_ids) end end diff --git a/lib/tasks/dashboards.rake b/lib/tasks/dashboards.rake index 63c9a2966..74a1bebf2 100644 --- a/lib/tasks/dashboards.rake +++ b/lib/tasks/dashboards.rake @@ -7,11 +7,11 @@ namespace :dashboards do if new_actions_ids.present? if proposal.published? - Dashboard::Mailer.new_actions_notification_rake_published(proposal, - new_actions_ids).deliver_later + Dashboard::Mailer.delay.new_actions_notification_rake_published(proposal, + new_actions_ids) else - Dashboard::Mailer.new_actions_notification_rake_created(proposal, - new_actions_ids).deliver_later + Dashboard::Mailer.delay.new_actions_notification_rake_created(proposal, + new_actions_ids) end end end