title: Rails: finding a record in an activerecord collection
body: <p>I have a product table and a set of variations for that product. 
  I want to load in all the variations for a given product, then update individual records.</p>
  
  <p>So say product X has 100 variations and I want to edit one of the variations. 
  I query for all the variations that exist for the product.  </p>
  
  <pre><code>vars = Variation.where(:product_id =&gt; 1) # =&gt; select * from variations
                                           #       where product_id = 1
  </code></pre>
  
  <p>select count = 1.<br>
  and I adjust the first record<br>
  update count = 1</p>
  
  <p>Now I want to edit the record in this collection where the id = 10, but I don't want to go back to the database to pull down the record. 
  Why should I?  I already have it in memory from the first select, right?</p>
  
  <p>I might also like to read a bit of data from the record too.  Say the price of the variation. </p>
  
  <p>I most definitely don't want to query the database for data I already have in memory.</p>