Browse files

Added documentation for automatic layout inclusion #328 [Marcel]

git-svn-id: 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent d19b181 commit eeae1eecb9d02c4a3d8cf8436503f594acd8b302 @dhh dhh committed Dec 19, 2004
Showing with 9 additions and 0 deletions.
  1. +9 −0 actionpack/lib/action_controller/layout.rb
9 actionpack/lib/action_controller/layout.rb
@@ -114,6 +114,15 @@ class << self
# If you have a layout that by default is applied to all the actions of a controller, you still have the option to rendering
# a given action without a layout. Just use the method <tt>render_without_layout</tt>, which works just like Base.render --
# it just doesn't apply any layouts.
+ #
+ # == Automatic layout assignment
+ #
+ # If there is a template in <tt>app/views/layouts/</tt> with the same name as the current controller then it will be automatically
+ # set as that controller's layout unless explicitly told otherwise. Say you have a WeblogController, for example. If a template named
+ # <tt>app/views/layouts/weblog.rhtml</tt> or <tt>app/views/layouts/weblog.rxml</tt> exists then it will be automatically set as
+ # the layout for your WeblogController. You can create a layout with the name <tt>application.rhtml</tt> or <tt>application.rxml</tt>
+ # and this will be set as the default controller if there is no layout with the same name as the current controller and there is
+ # no layout explicitly assigned with the +layout+ method. Setting a layout explicity will always override the automatic behaviour.
module ClassMethods
# If a layout is specified, all actions rendered through render and render_action will have their result assigned
# to <tt>@content_for_layout</tt>, which can then be used by the layout to insert their contents with

0 comments on commit eeae1ee

Please sign in to comment.