title: What does the asterisk before the variable mean in the named_scope argument list?
body: <p>I've got a named scope like this:</p>
  
  <pre><code>named_scope :by_items, lambda |*items| {
    :joins =&gt; :items,
    :conditions =&gt; ["items.id in (?)", items.map(&amp;::id)]
  }
  </code></pre>
  
  <p>What's the <code>*item</code> mean?  When I call it with <code>Item.find(:first, ...)</code> it works fine.  If I try to call using a collection, <code>Item.find(:all, ...)</code> it fails.</p>
  
  <p>From a different SO question, I know the signature is supposed to be:</p>
  
  <pre><code>Order.by_items(item0, item1, ...)
  </code></pre>
  
  <p>So, my question <em>really</em> is, how do I turn an Array into a comma separated argument list?</p>
  
  <p><strong>UPDATE0</strong></p>
  
  <p>From <a href="http://martinfowler.com/dslwip/LiteralMap.html" rel="noreferrer">Martin Fowler</a> I've learned:</p>
  
  <blockquote>
    <p>(Using a "*" in the argument list helps in working with variable arguments in ruby. In the argument list *disks indicates a vararg. I can then refer to all the disks passed in as an array named "disks". If I call another function with "*disks" the elements of the disks array are passed in as separate arguments.)</p>
  </blockquote>
  
  <p><strong>UPDATE1</strong></p>
  
  <p>More on <a href="https://stackoverflow.com/questions/776462/where-is-it-legal-to-use-ruby-splat-operator">the "splat" operator</a>.</p>