This project is archived and is in readonly mode.
[PATCH] For Rails 2.3 stable. Add layout override option to ActionMailer
Reported by Scott Windsor | September 14th, 2009 @ 08:23 PM
There's current no way override a layout for a given action mailer action. With actioncontroller, you can always explicitly set :layout in a render call, but many times you are using the default :render with actionmailer. Following the actionmailer pattern of using accessors, I've added a new accessor for setting the layout of an action. I've attached the patch for the 2-3-stable branch. Let me know if you'd like a patch for master, but right now all of the unit test for layouts are broken, so I'm sure it's in flux right now.
ExampleMailer < ActionMailer::Base
layout "default"
def example(recipient)
recipients recipient
subject "You have a mail"
from "tester@example.com"
layout "other"
end end
Comments and changes to this ticket
-
Scott Windsor September 14th, 2009 @ 08:23 PM
- Tag changed from action_mailer to 2-3-stable, 2.3, action_mailer
-
Scott Windsor September 14th, 2009 @ 09:06 PM
- Tag changed from 2-3-stable, 2.3, action_mailer to 2-3-stable, 2.3, action_mailer, patch
-
CancelProfileIsBroken September 25th, 2009 @ 12:12 PM
- Tag changed from 2-3-stable, 2.3, action_mailer, patch to 2-3-stable, 2.3, action_mailer, bugmash, patch
-
Blue Box Jesse September 26th, 2009 @ 09:52 PM
+1
Logic for the feature makes sense and allows for easy clean up of Action Mailer templates.
Patch applies successfully to 2.3.0.
Only concern is the test no longer checks that the old formatting works. Would it be worth while to have two tests?
-
Scott Windsor September 26th, 2009 @ 11:08 PM
Jesse, do you know why the old test are broken? If so, I don't mind fixing them.
-
Anuj Dutta September 26th, 2009 @ 11:55 PM
+1 - for the idea.
The tests aren't broken on 2-3-stable.
-
sr.iniv.t September 27th, 2009 @ 07:10 PM
+1 verified.
The idea is nice addition. The patch applies cleanly on 2-3-stable and tests pass.
-
Elad Meidar September 27th, 2009 @ 07:15 PM
+1 verified on Master and 2-3-stable, -1 on patch.... i'd rather to have a new test as Jesse suggested, rather than replacing the existing one.
-
Scott Windsor September 27th, 2009 @ 08:28 PM
Makes sense to me. Here's the new patch with new unit tests. Thanks for the feedback!
-
Anuj Dutta September 28th, 2009 @ 09:57 AM
error: patch failed: actionmailer/lib/action_mailer/base.rb:354 error: actionmailer/lib/action_mailer/base.rb: patch does not apply error: patch failed: actionmailer/test/mail_layout_test.rb:14 error: actionmailer/test/mail_layout_test.rb: patch does not apply
On 2-3-stable
-
Scott Windsor September 28th, 2009 @ 04:24 PM
Look like there have been commits since my last patch. Here's the lastest one - let me know if it works for you now.
-
Anuj Dutta September 28th, 2009 @ 06:12 PM
Nope same error message. May be someone else should verify it as well because I have applied several patches and my fork is ahead of yours probably.
-
Scott Windsor September 29th, 2009 @ 03:24 AM
Try applying on a clean 2-3-stable branch and see if it applies cleanly.
-
Scott Windsor November 30th, 2009 @ 07:47 AM
any update? this is still working good for me. Who should I contact to review this?
-
Anuj Dutta November 30th, 2009 @ 08:02 AM
I will apply it to the current 2-3-stable branch today and let you know the outcome.
-
Anuj Dutta November 30th, 2009 @ 08:10 AM
I applied it and it does not give me any errors now. Hope it helps.
-
Rizwan Reza February 12th, 2010 @ 12:46 PM
- Tag changed from 2-3-stable, 2.3, action_mailer, bugmash, patch to 2-3-stable, 2.3, action_mailer, patch
-
Santiago Pastorino February 2nd, 2011 @ 04:55 PM
- State changed from new to open
- Tag changed from 2-3-stable, 2.3, action_mailer, patch to 2-3-stable, 23, action_mailer, patch
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:55 PM
- State changed from open to stale
-
swindsor February 2nd, 2011 @ 07:24 PM
This isn't a bugfix, it's a feature request. I'm trying to help the rails team out by providing new functionality. It's for rails 2-3-stable, not rails 3.
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>