From 1b0da48fe98abc67b56bc76f2af59a90198b21cc Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 29 Dec 2004 13:36:27 +0000 Subject: Added documentation for using render_with_layout git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@272 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/layout.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'actionpack/lib/action_controller/layout.rb') diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index 6785967208..95b50a2eec 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -115,6 +115,22 @@ module ActionController #:nodoc: # a given action without a layout. Just use the method render_without_layout, which works just like Base.render -- # it just doesn't apply any layouts. # + # == Using a different layout in the action render call + # + # If most of your actions use the same layout, it makes perfect sense to define a controller-wide layout as described above. + # Some times you'll have exceptions, though, where one action wants to use a different layout than the rest of the controller. + # This is possible using render_with_layout method. It's just a bit more manual work as you'll have to supply fully + # qualified template and layout names as this example shows: + # + # class WeblogController < ActionController::Base + # def help + # render_with_layout "help/index", "200", "layouts/help" + # end + # end + # + # As you can see, you pass the template as the first parameter, the status code as the second ("200" is OK), and the layout + # as the third. + # # == Automatic layout assignment # # If there is a template in app/views/layouts/ with the same name as the current controller then it will be automatically -- cgit v1.2.3