title: Rails Query limit
body: <p>I have a query of pictures like this</p>
  
  <pre><code>pictures = Picture.near([latitude, longitude], 6.8).where("created_at &gt;= :time",{:time =&gt; time })
  </code></pre>
  
  <p>and I took out the tags which is associated with this model (every picture <code>has_many :tags</code>) like so</p>
  
  <pre><code>@tags = Tag.find(:all, :conditions =&gt; ["picture_id in (?)",pictures.collect(&amp;:id)])
  </code></pre>
  
  <p>I used a query to pull out an attribute of each tag</p>
  
  <pre><code>@tags.map(&amp;:tagcontent)
  </code></pre>
  
  <p>What I need to do is limit the results of the tags that come out. so I replaced</p>
  
  <pre><code>@tags = Tag.find(:all, :conditions =&gt; ["picture_id in (?)",pictures.collect(&amp;:id)])
  </code></pre>
  
  <p>with this</p>
  
  <pre><code>numoftags = 6
  tags = Tag.limit(numoftags).find(:all, :conditions =&gt; ["picture_id in (?)",pictures.collect(&amp;:id)])
  </code></pre>
  
  <p>but this only yields 4 tags, when I know there is least 6 that can be pulled out. How should I modify this function.</p>