title: "warning: multiple values for a block parameter (2 for 1)" in Ruby
body: <p>I have a function users_by_role</p>
  
  <p>and it returns data in following format,</p>
  
  <pre><code>[
    [#&lt;Role id: 1, name: "Developer"&gt;,[#&lt;User id:1, name: "Abc"&gt;,#&lt;User id:2, name: "xyz"&gt;]]
    [#&lt;Role id: 2, name: "Tester"&gt;,[#&lt;User id:11, name: "Abcd"&gt;,#&lt;User id:12, name: "wxyz"&gt;]]
  ]
  </code></pre>
  
  <p>Now, I want to select users for given Role/s</p>
  
  <p>I am using, </p>
  
  <pre><code>project.users_by_role.select{|o| o.first.name == "Developer"}
  </code></pre>
  
  <p>where project is a Project object</p>
  
  <p>All good, code returns me the data but along with which I get following warning</p>
  
  <blockquote>
    <p>warning: multiple values for a block parameter (2 for 1)</p>
  </blockquote>
  
  <p>Also I am looking for optimized and shorter way of doing this</p>
  
  <p>Complete code snippet looks like:</p>
  
  <pre><code>project.users_by_role.select{|o| o.first.name == "Developer" }.collect{|e| e.last.map{|f| [f.id,f.firstname + ' ' + f.lastname]}}.flatten(1).uniq
  </code></pre>
  
  <p>By above code I want to get all the user names for a given role.</p>