sends notification email to each voter

This commit is contained in:
rgarcia
2016-06-01 21:40:23 +02:00
parent 6e4ed0b895
commit ca26b3423b
6 changed files with 53 additions and 3 deletions

View File

@@ -10,6 +10,9 @@ class ProposalNotificationsController < ApplicationController
@notification = ProposalNotification.new(notification_params)
@proposal = Proposal.find(notification_params[:proposal_id])
if @notification.save
@proposal.voters.each do |voter|
Mailer.proposal_notification(@notification, voter).deliver_later
end
redirect_to @notification, notice: I18n.t("flash.actions.create.proposal_notification")
else
render :new