title: Rails scope with array as argument Rails 4
body: <p>I'd have two attributes in my <code>Member</code> model, <code>first_name</code> and <code>last_name</code>. My requirement is that I will be given an array of full names:</p>
  
  <pre><code>["Jane Doe", "John Doe", "Foo Bar"]
  </code></pre>
  
  <p>And, for each element I need to:</p>
  
  <ol>
  <li>Parse each element into first and last names</li>
  <li>Find each Member record by <code>first_name</code> and <code>last_name</code> (if it exists)</li>
  </ol>
  
  <p>I've tried to create this within a model scope, like this:</p>
  
  <pre><code>class Member &lt; ActiveRecord::Base
  
    scope :find_by_full_name, -&gt; (full_name) { |full_name|
        first_name = full_name.split(' ').first
        last_name = full_name.split(' ').last
        where(first_name: first_name, last_name: last_name)
    }
  </code></pre>
  
  <p>It works with a string, but not an array.  I reviewed this article -- <a href="https://stackoverflow.com/a/8155276/4379077">https://stackoverflow.com/a/8155276/4379077</a>.  It looks like Rails should detect if it's an array or a string, and handle each type accordingly.  After a bunch or console attempts (inc. turning the element to string) I'm at a loss of what I'm doing wrong, or maybe I should be going at in a different way besides creating a scope.  Any help is appreciated.</p>