Module: Ramaze::Helper::Layout

Defined in:
lib/ramaze/helper/layout.rb

Overview

Provides wrapper methods for a higher-level approach than the core layout method. These are useful for simpler layout needs, particularly:

  • layout all actions

  • layout a whitelist of actions

  • layout all but a blacklist of actions

As with the core layout method, the layout rules apply only to the controller on which they are applied. Furthermore, multiple layout definitions are not combined; only the last definition will be used.

This helper is one of the default helpers, so no explicit helper call is necessary before using it in your controllers.

Usage:

class MainController < Controller
  # Apply the default layout (e.g. ./layout/default.xhtml) to all
  # three actions.
  set_layout 'default'
  def action1; end
  def action2; end
  def action3; end
end

class MainController < Controller
  # These two layout definitions accomplish the same thing.  The
  # first uses a whitelist, the second uses a blacklist.
  set_layout 'default' => [:laid_out1, :laid_out2]
  set_layout_except 'default' => [:not_laid_out1, :not_laid_out2]

  def laid_out1; end
  def laid_out2; end

  def not_laid_out1; end
  def not_laid_out2; end
end

Defined Under Namespace

Modules: SingletonMethods

Class Method Summary collapse

Class Method Details

.included(into) ⇒ Object



42
43
44
# File 'lib/ramaze/helper/layout.rb', line 42

def self.included(into)
  into.extend SingletonMethods
end