How to render a layout before a template

108 Views Asked by At

I have some subclasses of ActionMailer::Base, each of which has a different version of a layout, and they all have a common template file. The template file has a portion that should depend on which layout is used.

I wrote the dependent part of the template file using instance variables, and set those value in the layouts (each layout with different values), and hoped the setting in the layout would affect rendering of the template. However, the rendering did not work the way I intended; it turned out that Rails renders the layout after the template.

Is there a way to make rendering of the template file dependent on which layout it is used with, or let the layout be rendered before the template?

0

There are 0 best solutions below