Store message receivers in a new table instead of in a serializied value
This commit is contained in:
parent
1cb7f888b7
commit
f8148e7d30
7 changed files with 96 additions and 35 deletions
|
|
@ -5,14 +5,16 @@ class MessageNotifier < UserNotifier
|
|||
message_id = args.first
|
||||
message = Message.find(message_id)
|
||||
|
||||
message.recipients.each do |recipient|
|
||||
message.message_recipients.each do |message_recipient|
|
||||
recipient = message_recipient.user
|
||||
if recipient.receive_email?
|
||||
Mailer.deliver_now_with_user_locale recipient do
|
||||
MessagesMailer.foodsoft_message(recipient, message)
|
||||
end
|
||||
message_recipient.update_attribute :email_state, :sent
|
||||
else
|
||||
message_recipient.update_attribute :email_state, :skipped
|
||||
end
|
||||
end
|
||||
|
||||
message.update_attribute(:email_state, 1)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue