Forum post notification does not include attachments
The send_notification is called on message creation, before attachments are added. In my case, I need links to attachments to be sent in the notification email.
My app/views/mailer/message_posted.text.erb do do this is:
<%= @message.content %> <% if @message.attachments.any? -%> ---<%= l(:label_attachment_plural).ljust(37, '-') %> <% @message.attachments.each do |attachment| -%> <%=attachment.filename%>: <%=send(:named_attachment_path, attachment, attachment.filename,:only_path=>false) %> (<%= number_to_human_size(attachment.filesize) %>) <% end -%> <% end -%> <%= @author.firstname + " " + @author.lastname + " - "+ @author.mail %>
If the forum message is created by an incoming email (with attachments) then no attachements are shown in outgoing notifications. If the forum message is created via the web form, the attachments are shown.
I fixed this by changing the send_notification trigger to after_commit. Patch attached.