module ActionView::Layouts::ClassMethods

Public Instance Methods

layout(layout, conditions = {}) click to toggle source

Specify the layout to use for this class.

If the specified layout is a:

String

the String is the template name

Symbol

call the method specified by the symbol

Proc

call the passed Proc

false

There is no layout

true

raise an ArgumentError

nil

Force default layout behavior with inheritance

Return value of Proc and Symbol arguments should be String, false, true, or nil with the same meaning as described above.

Parameters

  • layout - The layout to use.

Options (conditions)

  • :only - A list of actions to apply this layout to.

  • :except - Apply this layout to all actions but this one.

# File lib/action_view/layouts.rb, line 268
def layout(layout, conditions = {})
  include LayoutConditions unless conditions.empty?

  conditions.each { |k, v| conditions[k] = Array(v).map(&:to_s) }
  self._layout_conditions = conditions

  self._layout = layout
  _write_layout_method
end

Private Instance Methods

_implied_layout_name() click to toggle source

If no layout is supplied, look for a template named the return value of this method.

Returns

  • String - A template name

# File lib/action_view/layouts.rb, line 344
def _implied_layout_name
  controller_path
end