Ruby find and return objects in an array based on an attribute : <p>How can you iterate through an array of objects and return the entire object if a certain attribute is correct? </p>

<p>I have the following in my rails app</p>

<pre><code>array_of_objects.each { |favor| favor.completed == false }

array_of_objects.each { |favor| favor.completed }
</code></pre>

<p>but for some reason these two return the same result! I have tried to replace <code>each</code> with <code>collect</code>, <code>map</code>, <code>keep_if</code> as well as <code>!favor.completed</code> instead of <code>favor.completed == false</code> and none of them worked! </p>

<p>Any help is highly appreciated!</p>
