Permalink
Browse files

Typo and Style Corrections

  • Loading branch information...
1 parent 9c0064d commit d2b8564ab213d0b63790297f29696a277812eea5 @JosephPecoraro JosephPecoraro committed May 29, 2009
Showing with 17 additions and 17 deletions.
  1. +17 −17 railties/guides/source/layouts_and_rendering.textile
View
34 railties/guides/source/layouts_and_rendering.textile
@@ -204,7 +204,7 @@ TIP: You don't need to call +to_xml+ on the object that you want to render. If y
h5. Rendering Vanilla JavaScript
-Rails can render vanilla JavaScript (as an alternative to using +update+ with n +.rjs+ file):
+Rails can render vanilla JavaScript (as an alternative to using +update+ with an +.rjs+ file):
<ruby>
render :js => "alert('Hello Rails');"
@@ -266,7 +266,7 @@ render :xml => photo, :location => photo_url(photo)
h5. Finding Layouts
-To find the current layout, Rails first looks for a file in +app/views/layouts+ with the same base name as the controller. For example, rendering actions from the +PhotosController+ class will use +app/views/layouts/photos.html.erb+ (or +app/views/layouts/photos.builder+). If there is no such controller-specific layout, Rails will use +app/views/layouts/application.html.erb+ ot +app/views/layouts/application.builder+. If there is no +.erb+ layout, Rails will use a +.builder+ layout if one exists. Rails also provides several ways to more precisely assign specific layouts to individual controllers and actions.
+To find the current layout, Rails first looks for a file in +app/views/layouts+ with the same base name as the controller. For example, rendering actions from the +PhotosController+ class will use +app/views/layouts/photos.html.erb+ (or +app/views/layouts/photos.builder+). If there is no such controller-specific layout, Rails will use +app/views/layouts/application.html.erb+ or +app/views/layouts/application.builder+. If there is no +.erb+ layout, Rails will use a +.builder+ layout if one exists. Rails also provides several ways to more precisely assign specific layouts to individual controllers and actions.
h6. Specifying Layouts on a per-Controller Basis
@@ -421,12 +421,12 @@ end
Note that the implicit render done by ActionController detects if +render+ has been called, and thus avoids this error. So this code will work with problems:
<ruby>
- def show
- @book = Book.find(params[:id])
- if @book.special?
- render :action => "special_show"
- end
+def show
+ @book = Book.find(params[:id])
+ if @book.special?
+ render :action => "special_show"
end
+end
</ruby>
This will render a book with +special?+ set with the +special_show+ template, while other books will render with the default +show+ template.
@@ -519,10 +519,10 @@ h4. Asset Tags
Asset tags provide methods for generating HTML that links views to assets like images, javascript, stylesheets, and feeds. There are four types of include tag:
-* auto_discovery_link_tag
-* javascript_include_tag
-* stylesheet_link_tag
-* image_tag
+* +auto_discovery_link_tag+
+* +javascript_include_tag+
+* +stylesheet_link_tag+
+* +image_tag+
You can use these tags in layouts or other views, although the tags other than +image_tag+ are most commonly used in the +&lt;head&gt;+ section of a layout.
@@ -622,16 +622,16 @@ To include +public/stylesheets/main.css+ and +public/photos/columns.css+:
<%= stylesheet_link_tag "main", "/photos/columns" %>
</erb>
-To include +http://example.com/main.cs+:
+To include +http://example.com/main.css+:
<erb>
-<%= stylesheet_link_tag "http://example.com/main.cs" %>
+<%= stylesheet_link_tag "http://example.com/main.css" %>
</erb>
-By default, +stylesheet_link_tag+ creates links with +media="screen" rel="stylesheet" type="text/css"+. You can override any of these defaults by specifying an appropriate option (:media, :rel, or :type):
+By default, +stylesheet_link_tag+ creates links with +media="screen" rel="stylesheet" type="text/css"+. You can override any of these defaults by specifying an appropriate option (+:media+, +:rel+, or +:type+):
<erb>
-<%= stylesheet_link_tag "main_print", media => "print" %>
+<%= stylesheet_link_tag "main_print", :media => "print" %>
</erb>
The +all+ option links every CSS file in +public/stylesheets+:
@@ -958,13 +958,13 @@ On pages generated by +NewsController+, you want to hide the top menu and add a
<% content_for :content do %>
<div id="right_menu">Right menu items here</div>
<%= yield(:news_content) or yield %>
- <% end -%>
+<% end -%>
<%= render :file => 'layouts/application' %>
</erb>
That's it. The News views will use the new layout, hiding the top menu and adding a new right menu inside the "content" div.
-There are several ways of getting similar results with different sub-templating schemes using this technique. Note that there is no limit in nesting levels. One can use the +ActionView::render+ method via +render :file => 'layouts/news'+ to base a new layout on the News layout. If one is sure she will not subtemplate the +News+ layout, she can ommit the +yield(:news_content) or + part.
+There are several ways of getting similar results with different sub-templating schemes using this technique. Note that there is no limit in nesting levels. One can use the +ActionView::render+ method via +render :file => 'layouts/news'+ to base a new layout on the News layout. If one is sure she will not subtemplate the +News+ layout, she can omit the +yield(:news_content) or + part.
h3. Changelog

0 comments on commit d2b8564

Please sign in to comment.