Browse files

Add warning about deprecated partials behavior to Layout/Rendering Guide

  • Loading branch information...
1 parent 1d84c15 commit 82f46da522bcfeec41d3c42f0d9f91191ae1e0d6 @ffmike ffmike committed Nov 1, 2008
View
10 railties/doc/guides/html/layouts_and_rendering.html
@@ -1225,7 +1225,7 @@ <h4 id="_passing_local_variables">3.4.4. Passing Local Variables</h4>
&lt;% end %&gt;
</tt></pre></div></div>
<div class="para"><p>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.</p></div>
-<div class="para"><p>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 <tt>:object</tt> option:</p></div>
+<div class="para"><p>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 <tt>:object</tt> option:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -1234,6 +1234,14 @@ <h4 id="_passing_local_variables">3.4.4. Passing Local Variables</h4>
<pre><tt>&lt;%= render :partial =&gt; "customer", :object =&gt; @new_customer %&gt;
</tt></pre></div></div>
<div class="para"><p>Within the <tt>customer</tt> partial, the <tt>@customer</tt> variable will refer to <tt>@new_customer</tt> from the parent view.</p></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<img src="./images/icons/warning.png" alt="Warning" />
+</td>
+<td class="content">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.</td>
+</tr></table>
+</div>
<div class="para"><p>If you have an instance of a model to render into a partial, you can use a shorthand syntax:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
View
4 railties/doc/guides/source/layouts_and_rendering.txt
@@ -806,7 +806,7 @@ _form.html.erb:
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:
[source, html]
-------------------------------------------------------
@@ -815,6 +815,8 @@ Every partial also has a local variable with the same name as the partial (minus
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:
[source, html]

0 comments on commit 82f46da

Please sign in to comment.