From 82f46da522bcfeec41d3c42f0d9f91191ae1e0d6 Mon Sep 17 00:00:00 2001 From: Mike Gunderloy Date: Sat, 1 Nov 2008 07:03:15 -0500 Subject: Add warning about deprecated partials behavior to Layout/Rendering Guide --- railties/doc/guides/html/layouts_and_rendering.html | 10 +++++++++- railties/doc/guides/source/layouts_and_rendering.txt | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'railties/doc/guides') diff --git a/railties/doc/guides/html/layouts_and_rendering.html b/railties/doc/guides/html/layouts_and_rendering.html index 8f78429610..c650a3bc0b 100644 --- a/railties/doc/guides/html/layouts_and_rendering.html +++ b/railties/doc/guides/html/layouts_and_rendering.html @@ -1225,7 +1225,7 @@ _form.html.erb: <% end %>

Although the same partial will be rendered into both views, the label on the submit button is controlled by a local variable passed into the partial.

-

Every partial also has a local variable with the same name as the partial (minus the underscore). By default, it will look for an instance variable with the same name as the partial in the parent. You can pass an object in to this local variable via the :object option:

+

Every partial also has a local variable with the same name as the partial (minus the underscore). You can pass an object in to this local variable via the :object option:

<%= render :partial => "customer", :object => @new_customer %>
 

Within the customer partial, the @customer variable will refer to @new_customer from the parent view.

+
+ + + +
+Warning +In previous versions of Rails, the default local variable would look for an instance variable with the same name as the partial in the parent. This behavior is deprecated in Rails 2.2 and will be removed in a future version.
+

If you have an instance of a model to render into a partial, you can use a shorthand syntax: