title: Limiting records in a model action
body: <p>How do I limit the number of records that I am outputting with the following code to only 3 records:</p>
  
  <p>User.rb</p>
  
  <pre><code>  def workouts_on_which_i_commented
      comments.map{|x|x.workout}.uniq
    end
  
    def comment_stream
     workouts_on_which_i_commented.map do |w|
       w.comments
     end.flatten.sort{|x,y| y.created_at &lt;=&gt; x.created_at}
   end
  </code></pre>
  
  <p>html.erb file</p>
  
  <pre><code>&lt;% current_user.comment_stream.each do |comment| %&gt;
      ...
  &lt;% end %&gt;
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>I'm using Rails 2.3.9</p>