Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionMailer subclass renders view when @@perform_deliveries = false

#1445

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?

Reported by Ryan Lowe · November 23rd, 2008 @ 11:11 AM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to invalid

    Should really ask in the mailing list - http://groups.google.com/group/r...

    Thanks

    March 12th, 2009 @ 05:37 PM

  2. Ryan Lowe
    Ryan Lowe

    I disagree, this is a regression of behaviour in Rails that's been around for a while.

    If this was meant to be a deprecation of behaviour, where's the alternative? How can I stop a mail from being sent from within a mailer method (action)?

    March 12th, 2009 @ 07:29 PM