From 7bb20659c295d2b6a2820295b948ae3a2c0fa99e Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Tue, 25 Apr 2006 04:03:51 +0000 Subject: Update layout and content_for documentation to use yield rather than magic @content_for instance variables. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4262 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/layout.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (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 7ecff73380..4e9e42d468 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -27,7 +27,7 @@ module ActionController #:nodoc: # that the header and footer are only mentioned in one place, like this: # # - # <%= @content_for_layout %> + # <%= yield %> # # # And then you have content pages that look like this: @@ -47,7 +47,7 @@ module ActionController #:nodoc: # references that won't materialize before rendering time: # #

<%= @page_title %>

- # <%= @content_for_layout %> + # <%= yield %> # # ...and content pages that fulfill these references _at_ rendering time: # @@ -159,10 +159,12 @@ module ActionController #:nodoc: # # 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. + # + # NOTE: The old notation for rendering the view from a layout was to expose the magic @content_for_layout instance + # variable. The preferred notation now is to use yield, as documented above. module ClassMethods - # If a layout is specified, all actions rendered through render and render_action will have their result assigned - # to @content_for_layout, which can then be used by the layout to insert their contents with - # <%= @content_for_layout %>. This layout can itself depend on instance variables assigned during action + # If a layout is specified, all rendered actions will have their result rendered + # when the layoutyield's. This layout can itself depend on instance variables assigned during action # performance and have access to them as any normal template would. def layout(template_name, conditions = {}) add_layout_conditions(conditions) -- cgit v1.2.3