# ActionMailer method level layouts

**URL:** <https://www.ruby-forum.com/t/actionmailer-method-level-layouts/173908>\
**Category:** Rails\
**Created:** [August 18, 2009, 2:59am UTC](https://www.ruby-forum.com/t/actionmailer-method-level-layouts/173908 "2009-08-18T02:59:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nextpulse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/71c47a/32.png) [@nextpulse](https://www.ruby-forum.com/u/nextpulse)\
**Post date:** [August 18, 2009, 2:59am UTC](https://www.ruby-forum.com/t/actionmailer-method-level-layouts/173908/1 "2009-08-18T02:59:41Z")

</div>

I am using layouts in 2.3’s ActionMalier.

I know I can specify a layout at the class level:

class MyMailer \< ActionMailer::Base  
layout ‘foo’  
…  
end

Is it possible to define one at the method level?

i.e.

class MyMailer \< ActionMailer::Base  
layout ‘foo’  
…  
def invite

# USE LAYOUT FOO2

end  
end

thanks.

---

<div class="post-metadata">

**Author:** ![nextpulse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/71c47a/32.png) [@nextpulse](https://www.ruby-forum.com/u/nextpulse)\
**Post date:** [August 18, 2009, 9:04am UTC](https://www.ruby-forum.com/t/actionmailer-method-level-layouts/173908/2 "2009-08-18T09:04:21Z")

</div>

render :layout =\> ‘foo’

---

<div class="post-metadata">

**Author:** ![nextpulse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/71c47a/32.png) [@nextpulse](https://www.ruby-forum.com/u/nextpulse)\
**Post date:** [August 18, 2009, 9:03pm UTC](https://www.ruby-forum.com/t/actionmailer-method-level-layouts/173908/3 "2009-08-18T21:03:55Z")

</div>

Are you sure?  
ActionMailer is a model.  
Render is for view.

---

<div class="post-metadata">

**Author:** ![nextpulse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/71c47a/32.png) [@nextpulse](https://www.ruby-forum.com/u/nextpulse)\
**Post date:** [August 19, 2009, 2:01am UTC](https://www.ruby-forum.com/t/actionmailer-method-level-layouts/173908/4 "2009-08-19T02:01:51Z")

</div>

Render is a private method on ActionMailer.

[http://apidock.com/rails/ActionMailer/Base/render](http://apidock.com/rails/ActionMailer/Base/render)

Any one else have ideas on how I can achieve this? Is it possible?  
(looking at the core source - nothing obvious comes to mind).
