diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-02-06 02:25:55 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-02-06 02:25:55 +0000 |
commit | b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb (patch) | |
tree | 491c3ce7d406a723e5c06e3bccf4559a0de86199 /railties/guides/source/layouts_and_rendering.textile | |
parent | 97612394672203eefd04e3b1947273a3ab4ec930 (diff) | |
parent | 96d610553e5fdaabc923835ab1f194070ddb4477 (diff) | |
download | rails-b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb.tar.gz rails-b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb.tar.bz2 rails-b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb.zip |
Merge commit 'mainstream/master'
Conflicts:
railties/guides/files/javascripts/code_highlighter.js
railties/guides/files/javascripts/guides.js
railties/guides/files/javascripts/highlighters.js
railties/guides/files/stylesheets/main.css
railties/guides/files/stylesheets/print.css
railties/guides/files/stylesheets/reset.css
railties/guides/files/stylesheets/style.css
railties/guides/files/stylesheets/syntax.css
railties/guides/rails_guides/indexer.rb
railties/guides/source/2_2_release_notes.textile
railties/guides/source/2_3_release_notes.textile
railties/guides/source/action_controller_overview.textile
railties/guides/source/action_mailer_basics.textile
railties/guides/source/active_record_basics.textile
railties/guides/source/activerecord_validations_callbacks.textile
railties/guides/source/association_basics.textile
railties/guides/source/caching_with_rails.textile
railties/guides/source/command_line.textile
railties/guides/source/debugging_rails_applications.textile
railties/guides/source/form_helpers.textile
railties/guides/source/getting_started.textile
railties/guides/source/i18n.textile
railties/guides/source/layout.html.erb
railties/guides/source/layouts_and_rendering.textile
railties/guides/source/migrations.textile
railties/guides/source/performance_testing.textile
railties/guides/source/plugins.textile
railties/guides/source/rails_on_rack.textile
railties/guides/source/routing.textile
railties/guides/source/security.textile
railties/guides/source/testing.textile
Diffstat (limited to 'railties/guides/source/layouts_and_rendering.textile')
-rw-r--r-- | railties/guides/source/layouts_and_rendering.textile | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile index dbaaed2281..d4738ec19f 100644 --- a/railties/guides/source/layouts_and_rendering.textile +++ b/railties/guides/source/layouts_and_rendering.textile @@ -228,7 +228,7 @@ render :file => filename, :content_type => 'application/rss' h6. The :layout Option -With most of the options to +render+, the rendered content is displayed as part of the current layout. You'll learn more about layouts and how to use them later in this guide. +With most of the options to +render+, the rendered content is displayed as part of the current layout. You'll learn more about layouts and how to use them later in this guide. You can use the +:layout+ option to tell Rails to use a specific file as the layout for the current action: @@ -296,7 +296,7 @@ You can use a symbol to defer the choice of layout until a request is processed: <ruby> class ProductsController < ApplicationController layout :products_layout - + def show @product = Product.find(params[:id]) end @@ -314,7 +314,7 @@ Now, if the current user is a special user, they'll get a special layout when vi <ruby> class ProductsController < ApplicationController layout proc{ |controller| controller. - # ... + # ... end </ruby> @@ -725,7 +725,7 @@ The +content_for+ method is very helpful when your layout contains distinct regi h4. Using Partials -Partial templates - usually just called "partials" - are another device for breaking apart the rendering process into more manageable chunks. With a partial, you can move the code for rendering a particular piece of a response to its own file. +Partial templates - usually just called "partials" - are another device for breaking apart the rendering process into more manageable chunks. With a partial, you can move the code for rendering a particular piece of a response to its own file. h5. Naming Partials @@ -826,7 +826,7 @@ If you have an instance of a model to render into a partial, you can use a short Assuming that the +@customer+ instance variable contains an instance of the +Customer+ model, this will use +_customer.html.erb+ to render it. -h5. Rendering Collections +h5. Rendering Collections Partials are very useful in rendering collections. When you pass a collection to a partial via the +:collection+ option, the partial will be inserted once for each member in the collection: @@ -949,9 +949,9 @@ h3. Changelog "Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/15 * December 27, 2008: Merge patch from Rodrigo Rosenfeld Rosas covering subtemplates -* December 27, 2008: Information on new rendering defaults by "Mike Gunderloy":credits.html#mgunderloy -* November 9, 2008: Added partial collection counter by "Mike Gunderloy":credits.html#mgunderloy -* November 1, 2008: Added +:js+ option for +render+ by "Mike Gunderloy":credits.html#mgunderloy -* October 16, 2008: Ready for publication by "Mike Gunderloy":credits.html#mgunderloy +* December 27, 2008: Information on new rendering defaults by "Mike Gunderloy":credits.html#mgunderloy +* November 9, 2008: Added partial collection counter by "Mike Gunderloy":credits.html#mgunderloy +* November 1, 2008: Added +:js+ option for +render+ by "Mike Gunderloy":credits.html#mgunderloy +* October 16, 2008: Ready for publication by "Mike Gunderloy":credits.html#mgunderloy * October 4, 2008: Additional info on partials (+:object+, +:as+, and +:spacer_template+) by "Mike Gunderloy":credits.html#mgunderloy (not yet approved for publication) -* September 28, 2008: First draft by "Mike Gunderloy":credits.html#mgunderloy (not yet approved for publication)
\ No newline at end of file +* September 28, 2008: First draft by "Mike Gunderloy":credits.html#mgunderloy (not yet approved for publication) |