title: issue in order clause and limit in active record
body: <p>I am triggering this query</p>
  
  <pre><code>p "my query starts here..."
  @relevant_customers_for_total_spent = Customer.order("total_amount DESC").where('id IN (?)',@customers_ids).limit(relevant_customers_count_for_total_spent)
  
   p " -------  "
   p relevant_customers_count_for_total_spent  # output is: 1139
   p @relevant_customers_for_total_spent.count # output is: 2888
   p " -------  "
  </code></pre>
  
  <p>More over log is saying the actual query fired is:</p>
  
  <pre><code>SELECT COUNT(*) FROM `customers` WHERE (id IN (2,3,4,5,6,75,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,75,296,297,298,2889)) LIMIT 1139
  </code></pre>
  
  <p><strong>So the questions are:</strong></p>
  
  <ol>
  <li>Why there is no order clause in the actual query?</li>
  <li>Why @relevant_customers_for_total_spent.count is greater than relevant_customers_count_for_total_spent. It should be equals to or less than.</li>
  </ol>
  
  <p>*<em>Update -1 *</em></p>
  
  <p>I got the second issue:</p>
  
  <pre><code>@relevant_customers_for_total_spent.length 
  </code></pre>
  
  <p>is the right way to count the number of elements.</p>
  
  <p><strong>Update - 2</strong></p>
  
  <p>I have some customer ids in an array something like [2,3,4,5,6,75,56,57,58,59,60,61,62]. I have a attribute ie total_amount in Customer model. I want to rearrage all the customers ids in the order of total_amount (DESC). I have a another factor which specifies limit ie how many number of customers i need from that list. Some thing like if its 5. So I need top 5 customers from that araay based upon total_amount.</p>