title: How to exclude an array of ids from query in Rails (using ActiveRecord)?
body: <p>I would like to perform an ActiveRecord query that returns all records except those records that have certain ids.  The ids I would like excluded are stored in an array.  So:</p>
  
  <pre><code>ids_to_exclude = [1,2,3]
  array_without_excluded_ids = Item. ???
  </code></pre>
  
  <p>I'm not sure how to complete the second line.</p>
  
  <p><em>Background: What I've already tried:</em></p>
  
  <p>I'm not sure background is necessary, but I've already tried various combinations of .find and .where.  For example:</p>
  
  <pre><code>array_without_excluded_ids = Item.find(:all, :conditions =&gt; { "id not IN (?)", ids_to_exclude })
  array_without_excluded_ids = Item.where( "items.id not IN ?", ids_to_exclude)
  </code></pre>
  
  <p>These fail.  <a href="https://stackoverflow.com/questions/2580980/exclude-some-ids-from-result-in-rails-activerecord">This tip</a> might be on the right track, but I have not succeeded in adapting it.  Any help would be greatly appreciated.</p>