aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-04-05 02:16:24 -0700
committerXavier Noria <fxn@hashref.com>2010-04-05 02:16:24 -0700
commit43d02dffcbd6d3defea7c37892e4d47bbc061bc5 (patch)
treeb1332f1c5482559ac26c86a2f96cc7b0338077b9 /actionpack/lib
parent9ed176d7111ecef7918a7e3c50540a7a51071df9 (diff)
downloadrails-43d02dffcbd6d3defea7c37892e4d47bbc061bc5.tar.gz
rails-43d02dffcbd6d3defea7c37892e4d47bbc061bc5.tar.bz2
rails-43d02dffcbd6d3defea7c37892e4d47bbc061bc5.zip
<% yield to <%= yield in rdoc of _layout_for, and copy-edits it now that we are on it
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/render/layouts.rb48
1 files changed, 31 insertions, 17 deletions
diff --git a/actionpack/lib/action_view/render/layouts.rb b/actionpack/lib/action_view/render/layouts.rb
index 578f39d817..7311730a19 100644
--- a/actionpack/lib/action_view/render/layouts.rb
+++ b/actionpack/lib/action_view/render/layouts.rb
@@ -1,37 +1,51 @@
module ActionView
module Layouts
- # You can think of a layout as a method that is called with a block. _layout_for
- # returns the contents that are yielded to the layout. If the user calls yield
- # :some_name, the block, by default, returns content_for(:some_name). If the user
- # calls yield, the default block returns content_for(:layout).
+ # Returns the contents that are yielded to a layout, given a name or a block.
#
- # The user can override this default by passing a block to the layout.
+ # You can think of a layout as a method that is called with a block. If the user calls
+ # <tt>yield :some_name</tt>, the block, by default, returns <tt>content_for(:some_name)</tt>.
+ # If the user calls simply +yield+, the default block returns <tt>content_for(:layout)</tt>.
#
- # ==== Example
+ # The user can override this default by passing a block to the layout:
#
# # The template
- # <%= render :layout => "my_layout" do %>Content<% end %>
+ # <%= render :layout => "my_layout" do %>
+ # Content
+ # <% end %>
#
# # The layout
- # <html><% yield %></html>
+ # <html>
+ # <%= yield %>
+ # </html>
#
- # In this case, instead of the default block, which would return content_for(:layout),
- # this method returns the block that was passed in to render layout, and the response
- # would be <html>Content</html>.
+ # In this case, instead of the default block, which would return <tt>content_for(:layout)</tt>,
+ # this method returns the block that was passed in to <tt>render :layout</tt>, and the response
+ # would be
#
- # Finally, the block can take block arguments, which can be passed in by yield.
+ # <html>
+ # Content
+ # </html>
#
- # ==== Example
+ # Finally, the block can take block arguments, which can be passed in by +yield+:
#
# # The template
- # <%= render :layout => "my_layout" do |customer| %>Hello <%= customer.name %><% end %>
+ # <%= render :layout => "my_layout" do |customer| %>
+ # Hello <%= customer.name %>
+ # <% end %>
#
# # The layout
- # <html><% yield Struct.new(:name).new("David") %></html>
+ # <html>
+ # <%= yield Struct.new(:name).new("David") %>
+ # </html>
#
# In this case, the layout would receive the block passed into <tt>render :layout</tt>,
- # and the Struct specified in the layout would be passed into the block. The result
- # would be <html>Hello David</html>.
+ # and the struct specified would be passed into the block as an argument. The result
+ # would be
+ #
+ # <html>
+ # Hello David
+ # </html>
+ #
def _layout_for(name = nil, &block) #:nodoc:
if !block || name
@_content_for[name || :layout]