instance method action_has_layout?

Ruby on Rails 3.1.12

Since v3.0.20 Last seen in v3.1.12

Available in: v3.0.20 v3.1.12

Signature

action_has_layout?()

Determines whether the current action has a layout by checking the action name against the :only and :except conditions set on the layout.

Returns
  • Boolean - True if the action has a layout, false otherwise.

Source
# File actionpack/lib/abstract_controller/layouts.rb, line 191
        def action_has_layout?
          return unless super

          conditions = _layout_conditions

          if only = conditions[:only]
            only.include?(action_name)
          elsif except = conditions[:except]
            !except.include?(action_name)
          else
            true
          end
        end

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

Defined in AbstractController::Layouts::ClassMethods::LayoutConditions

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close