Besides the content_for approach (which may or may not be what you want), there are several additional options.
You can use before_filter in the controller to set the variable:
Or you can leave the controller alone and just check the name of the controller in your layout:
# Layout if controller.controller_name == 'test'
source share