Forum: Ruby on Rails [Templates] [Noob] templates across controllers?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D'Andrew "Dave" Thompson (Guest)
on 2005-12-29 00:39
(Received via mailing list)
Fine Rails Hackers:

I am trying to decide how to approach a templating concern.

I would like to define a standard template for all of my pages
(including a
basic header, styles, footer) across my five base controllers: desktop,
events, financials, and records, account.

Is there a top level place to declare a template across the entire
application regardless of the controller?

I understand how to declare a template within a controller, say desktop
app/views/layouts/desktop.rhtml). But how do I define something that can
serve as a template for all of the controllers? I don't want to
the template for each controller (in the layout folder).

Thank you,

Chris (Guest)
on 2005-12-29 00:42
(Received via mailing list)

Try a


Chris Lowder (Guest)
on 2005-12-29 00:51
(Received via mailing list)
i think the best way to do this would be to have all your pages use
the same layout, and include the style-sheet, header and footer info
in there.

This should be easy to do, if u have a layout called application (and
no other layout files) your app will use this across all pages.
Alternatively you can declare the layout using the layout method (see
rails api for more information on that).
D'Andrew "Dave" Thompson (Guest)
on 2005-12-29 02:40
(Received via mailing list)
Worked like a charm.

I just found in the book where it notes the use of "application" for
applying layouts to all controllers. Of note, I had to remove the other
controller-named layouts in the same folder, which is the first place

This topic is locked and can not be replied to.