This project is archived and is in readonly mode.

#1445 ✓invalid
Ryan Lowe

ActionMailer subclass renders view when @@perform_deliveries = false

Reported by Ryan Lowe | November 23rd, 2008 @ 11:11 AM | in 2.x

I'm updating to Rails 2.2 and ActionMailer has changed behavior, specifically with its treatment of @@perform_deliveries.

I'm using a sort of clever "hack" in my ActionMailer subclass I found on a blog post: bailing out of sending the email if the user has set a preference not to receive it. I'm looking at the user's preference data in the mailer's action, setting @@perform_deliveries according to the user's preference (if no preference, it is true). If @@perform_deliveries is false I expect the template not to be rendered and the email not to be sent.

The code is here: http://gist.github.com/28090 I've included the mailer, the view, the test that is failing and its output.

This has worked up to and including Rails 2.1.0 and it does not with Rails 2.2.2

Is there a new way to do this kind of thing in Rails 2.2.x and that's why the old way is now broken?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages