Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3.2.14: ActionMailer fails to find template in production only
    primarykey
    data
    text
    <p>We have a Rails 3.2.14 app that is misbehaving in production only. Emails fail to send with the following error message:</p> <pre><code>ActionView::MissingTemplate (Missing template /invoice with {:locale=&gt;[:en], :formats=&gt;[:text], :handlers=&gt;[:erb, :builder]}. Searched in: * "/var/www/appname/releases/20131003214241/app/views" ): app/mailers/mailer.rb:42:in `block in invoice' app/mailers/mailer.rb:41:in `invoice' app/controllers/admin_controller.rb:410:in `resend_invoice' </code></pre> <p>The Mailer#invoice method looks like this:</p> <pre><code>def invoice(order, resent=false, receipt_or_invoice = "Receipt") @order = order @freebie = @order.freebie? @mail = true @transaction = @order.beanstream_transaction @user = @order.user recipient = @order.email_receipt_to || @user.email || "support@example.com" @receipt_or_invoice = receipt_or_invoice subject = @freebie ? "Your License" : "Your #{receipt_or_invoice.capitalize} and License Information#{ resent ? " (Resent)" : ""}" mail = mail(:to =&gt; [recipient], :subject =&gt; subject) mail.add_part(Mail::Part.new do content_type 'multipart/alternative' # THE ODD BIT vv mail.parts.reverse!.delete_if {|p| add_part p } end) mail.content_type 'multipart/mixed' mail.header['content-type'].parameters[:boundary] = mail.body.boundary @order.line_items.each do |li| aq_data = li.license.aquatic_prime_data if aq_data.present? attachments[li.license.aquatic_prime_filename] = {content: aq_data, mime_type: 'application/xml'} end end return mail end </code></pre> <p>A couple notes.</p> <ol> <li>This behaves fine in development using Pow. Production is using Apache+Passenger.</li> <li>Before this, the last change we made to our mailer was in June to add a new method. We've seen no other reports about failure to deliver emails. This makes me think something changed in the ActionMailer or other Rails gem that somehow caused this issue.</li> <li>The error also happens when Mailer.invoice is called from our store controller or other part of the code, so I think it's localized to the Mailer.</li> <li>In development, we're using Google SMTP server for sending mail, whereas we're using Postmark in production.</li> </ol> <p>Thanks in advance for any help or insights!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload