This project is archived and is in readonly mode.

#3200 ✓stale
Scott Windsor

[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

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