James Byrne
2012-Dec-05 21:22 UTC
Action Mailer 3.2.9 retruns duplicates in deliveries array
I am extracting a standalone batch application from a Rails 3.0.1 project. This requires only ActiveRecord and ActionMailer. In my testing I set ActionMailer::Base.delivery_method = :test This causes the mail to be delivered to the ActionMailer::Base.deliveries array. However, I am getting two of the test email messages placed in the deliveries array instead of just one. For example: ''[ #<Mail::Message:38151600, Multipart: false, Headers: <Date: Wed, 05 Dec 2012 16:05:16 -0500>, <From: forex.control-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org>, <To: forex.test-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org>, <Message-ID: <50bfb70ca7ea9_78aa14427fc856-Xg3uWU4dJZByRN6TQuuFFj0xfz0Twc0EoICukQnxbdvwwNc1L8eyVw@public.gmane.org>>, <Subject: [ForEx] 2012-12-05 - Foreign Exchange Rates Central Bank Update Notice>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>, #<Mail::Message:38151600, Multipart: false, Headers: <Date: Wed, 05 Dec 2012 16:05:16 -0500>, <From: forex.control-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org>, <To: forex.test-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org>, <Message-ID: <50bfb70ca7ea9_78aa14427fc856-Xg3uWU4dJZByRN6TQuuFFj0xfz0Twc0EoICukQnxbdvwwNc1L8eyVw@public.gmane.org>>, <Subject: [ForEx] 2012-12-05 - Foreign Exchange Rates Central Bank Update Notice>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>> ]'' I can forcibly fix this with a call to deliveries.unique but I would rather find out what is actually happening. Wherever this is occuring it is between the call to the mail method in the mailer class and the return from that class back to the calling script. As I provide no intervening code and since self.deliveries does not exist inside the mailer class on return from the mail method I gather that this array and method is being created and populated somewhere in the ActionMailer stack outside of my pervue. Does anyone have any idea why this is happening? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.