aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/html
diff options
context:
space:
mode:
authorMike Gunderloy <MikeG1@larkfarm.com>2008-10-29 08:16:40 -0500
committerMike Gunderloy <MikeG1@larkfarm.com>2008-10-29 08:16:40 -0500
commitd83eda9b696f2e51c0c79dfd028b8b2d20160426 (patch)
treebf8c9be448142967e946c07ad16b957bf63e4ef8 /railties/doc/guides/html
parent40d049e981cbf7d73debcd1e3d16bde420590897 (diff)
downloadrails-d83eda9b696f2e51c0c79dfd028b8b2d20160426.tar.gz
rails-d83eda9b696f2e51c0c79dfd028b8b2d20160426.tar.bz2
rails-d83eda9b696f2e51c0c79dfd028b8b2d20160426.zip
Clarify use of :select on :belongs_to in AR Associations Guide
Diffstat (limited to 'railties/doc/guides/html')
-rw-r--r--railties/doc/guides/html/association_basics.html8
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/doc/guides/html/association_basics.html b/railties/doc/guides/html/association_basics.html
index 96aae9c51a..9159eaab2a 100644
--- a/railties/doc/guides/html/association_basics.html
+++ b/railties/doc/guides/html/association_basics.html
@@ -1185,6 +1185,14 @@ http://www.gnu.org/software/src-highlite -->
<div class="para"><p>If you set the <tt>:readonly</tt> option to <tt>true</tt>, then the associated object will be read-only when retrieved via the association.</p></div>
<h5 id="_tt_select_tt"><tt>:select</tt></h5>
<div class="para"><p>The <tt>:select</tt> option lets you override the SQL <tt>SELECT</tt> clause that is used to retrieve data about the associated object. By default, Rails retrieves all columns.</p></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<img src="./images/icons/tip.png" alt="Tip" />
+</td>
+<td class="content">If you set the <tt>:select</tt> option on a <tt>belongs_to</tt> association, you should also set the <tt>foreign_key</tt> option to guarantee the correct results.</td>
+</tr></table>
+</div>
<h5 id="_tt_validate_tt"><tt>:validate</tt></h5>
<div class="para"><p>If you set the <tt>:validate</tt> option to <tt>true</tt>, then associated objects will be validated whenever you save this object. By default, this is <tt>false</tt>: associated objects will not be validated when this object is saved.</p></div>
<h4 id="_when_are_objects_saved">4.1.3. When are Objects Saved?</h4>