instance method layout

Ruby on Rails 3.2.22.5

Since v3.0.20 Last seen in v4.0.13

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13

Signature

layout(layout, conditions = {})

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, which will return the template name

false

There is no layout

true

raise an ArgumentError

nil

Force default layout behavior with inheritance

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.

Parameters

layout req
conditions opt = {}
Source
# File actionpack/lib/abstract_controller/layouts.rb, line 251
      def layout(layout, conditions = {})
        include LayoutConditions unless conditions.empty?

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

        @_layout = layout
        _write_layout_method
      end

Defined in actionpack/lib/abstract_controller/layouts.rb line 251 · View on GitHub · Improve this page · Find usages on GitHub

Defined in AbstractController::Layouts::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close