I want to use a sitewide default template and use a specific version in some
controllers to have a good DRY approach to my layout. Those controllers
should add a little bit more HTML before rendering the results of the
actions, in order to avoid copying the entire sitelayout every time.
How can I do that? Currently my code is like this:
class WelcomeController < ApplicationController
render :partial => "contact"
render :partial => "welcome"
This only shows the app/views/welcome/_contact.rhtml page. It does not show
the layout (that does work in other controllers where I don't use these
things). If I then enable the before_filter (is that the right usage, it
does not feel like that) then it only shows the
app/views/welcome/_welcome.rhtml page, which is not what I want either.
So how should I do this? How should I have this controller use the
layout 'mydefault', render the _welcome partial before every method and
also render the contact partial when the contact action is called?
I really think I'm not using the right tools here, especially before_filter
seems a bit wrong here.
Thanks for your help,