Module: LayoutOptions::ClassMethods
- Defined in:
- lib/layout_options/layout_options.rb
Instance Method Summary collapse
-
#layout_options(args = {}) ⇒ Object
layout_options - This method is available at the class level of your ApplicationController and any controller that inherits from it.
Instance Method Details
#layout_options(args = {}) ⇒ Object
layout_options - This method is available at the class level of your ApplicationController and any controller that inherits from it.
layout_options
accepts a single hash where the index is the layout name and the is the controller method(s) that will be using that layout. If you set the index to :none
no layout will be used. If no layout is specified it will default to using the ‘application’ layout.
All of the following examples will work controllers that inherit from InheritedResources::Base
.
# setting an overlay layout for a new method
class UsersController < ApplicationController
:overlay => :new
end
# setting an overlay layout for multiple methods
class UsersController < ApplicationController
:overlay => [:new, :edit]
end
# not using a layout
class UsersController < ApplicationController
:none => [:create, :destroy]
end
# using multiple layouts
class UsersController < ApplicationController
:overlay => [:new, :edit], :none => [:create, :destroy],
:foo => :show
end
56 57 58 |
# File 'lib/layout_options/layout_options.rb', line 56 def (args={}) LayoutOptions::Storage[controller_name] = args end |