diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-21 09:26:59 -0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-21 09:26:59 -0200 |
commit | fc8c0729881fff59e916f7ab180dbfa03ee1b891 (patch) | |
tree | d6ef92dbb96666ea473503fb70728a5f65d92e87 /railties/guides | |
parent | 410114e85ac0048de3fd932a5aaac2a11b45be86 (diff) | |
download | rails-fc8c0729881fff59e916f7ab180dbfa03ee1b891.tar.gz rails-fc8c0729881fff59e916f7ab180dbfa03ee1b891.tar.bz2 rails-fc8c0729881fff59e916f7ab180dbfa03ee1b891.zip |
Use render :template instead of render :file in nested layouts example. render :template is a bit faster and more semantic compared to render :file.
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/layouts_and_rendering.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile index 088e1f817c..c65ea5c797 100644 --- a/railties/guides/source/layouts_and_rendering.textile +++ b/railties/guides/source/layouts_and_rendering.textile @@ -1185,12 +1185,12 @@ On pages generated by +NewsController+, you want to hide the top menu and add a <div id="right_menu">Right menu items here</div> <%= yield(:news_content) or yield %> <% end %> -<%= render :file => 'layouts/application' %> +<%= render :template => '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 you are sure you will not subtemplate the +News+ layout, you can replace the +yield(:news_content) or yield+ with simply +yield+. +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 :template => 'layouts/news'+ to base a new layout on the News layout. If you are sure you will not subtemplate the +News+ layout, you can replace the +yield(:news_content) or yield+ with simply +yield+. h3. Changelog |