Permalink
Browse files

Update to reflect proper update/update_all calls

  • Loading branch information...
1 parent ea8f132 commit ff36a6d910e476d3341e2c40c0eff1389e7d649e @durran durran committed Aug 8, 2012
Showing with 20 additions and 2 deletions.
  1. +1 −1 en/mongoid/docs/persistence.html
  2. +19 −1 en/mongoid/docs/querying.html
@@ -179,7 +179,7 @@
<i>
Saves the changed attributes to the database
atomically, or insert the document if flagged as a new_record via
- <code>Model#rew_record?</code>. Can bypass validations if wanted.
+ <code>Model#new_record?</code>. Can bypass validations if wanted.
</i>
</p>
</td>
@@ -445,7 +445,7 @@
<td class='doc'>
<code>Criteria#update</code>
<p class='doc'>
- <i>Update attributes of all matching documents.</i>
+ <i>Update attributes of the first matching document.</i>
</p>
</td>
<td>
@@ -455,6 +455,24 @@
</td>
<td>
<div class="CodeRay">
+ <div class="code"><pre>collections[<span class="symbol">:bands</span>].find(&#x000A; { name: <span class="string"><span class="delimiter">&quot;</span><span class="content">Photek</span><span class="delimiter">&quot;</span></span> }&#x000A;).update({ <span class="string"><span class="delimiter">&quot;</span><span class="content">$set</span><span class="delimiter">&quot;</span></span> =&gt; { label: <span class="string"><span class="delimiter">&quot;</span><span class="content">Mute</span><span class="delimiter">&quot;</span></span> }})</pre></div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td class='doc'>
+ <code>Criteria#update_all</code>
+ <p class='doc'>
+ <i>Update attributes of all matching documents.</i>
+ </p>
+ </td>
+ <td>
+ <div class="CodeRay">
+ <div class="code"><pre><span class="constant">Band</span>.where(name: <span class="string"><span class="delimiter">&quot;</span><span class="content">Photek</span><span class="delimiter">&quot;</span></span>).update_all(label: <span class="string"><span class="delimiter">&quot;</span><span class="content">Mute</span><span class="delimiter">&quot;</span></span>)</pre></div>
+ </div>
+ </td>
+ <td>
+ <div class="CodeRay">
<div class="code"><pre>collections[<span class="symbol">:bands</span>].find(&#x000A; { name: <span class="string"><span class="delimiter">&quot;</span><span class="content">Photek</span><span class="delimiter">&quot;</span></span> }&#x000A;).update_all({ <span class="string"><span class="delimiter">&quot;</span><span class="content">$set</span><span class="delimiter">&quot;</span></span> =&gt; { label: <span class="string"><span class="delimiter">&quot;</span><span class="content">Mute</span><span class="delimiter">&quot;</span></span> }})</pre></div>
</div>
</td>

0 comments on commit ff36a6d

Please sign in to comment.