This project is archived and is in readonly mode.
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
-
Pratik March 12th, 2009 @ 05:37 PM
- State changed from new to invalid
Should really ask in the mailing list - http://groups.google.com/group/r...
Thanks
-
Ryan Lowe March 12th, 2009 @ 07:29 PM
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)?
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>