Take the 2-minute tour ×

I have a user_mailer with a layout.

For one of my actionmailer methods I want the mailer to NOT use the default layout. But I can't see to find a setting for No Layout.

Any ideas?

share|improve this question
add comment

2 Answers

up vote 14 down vote accepted

Simply specify in your mailer:

layout false

You can also append :only => my_action (or :except) to limit the methods it applies to.

(applicable API documentation)

share|improve this answer
Andrew, thanks but I want this for one mailer, not all. Where would this go when I have something like def XXX mail(:to => ....) end –  AnApprentice Mar 7 '11 at 1:21
See updated answer. There is, always, more detail in the API as well. –  Andrew Marshall Mar 7 '11 at 1:24
add comment

The layout method can accept the name of a method; use the method to determine whether to show a layout and return that name or false.

layout :choose_layout

def choose_layout
  if something
    return false
    return 'application'
share|improve this answer
add comment

Your Answer


