title: Ruby/Rails - How can I add items to an object with each loop iteration
body: <p>I'm trying to figure ruby out a bit more.....</p>
  
  <p>If I have an object </p>
  
  <pre><code> @Trees =  Tree.find( :all )
  </code></pre>
  
  <p>Then make a loop where for each tree I find, add some apples...</p>
  
  <pre><code> for tree in @trees   
       @apples = Apple.where(:tree_location = &gt; tree.id )
   end
  </code></pre>
  
  <p>How can I add the additional apples found from each iteration of the loop to the initial object @apples ?</p>
  
  <p>I tried </p>
  
  <pre><code>    @apples = @apples + Apple.where(:tree_location = &gt; tree.id )
  </code></pre>
  
  <p>but got the error "can't convert Apple into Array"</p>
  
  <p>Thanks for the help .... i'm on a cider deadline <strong><em>lol, corny i know</em></strong></p>