Correct way to write where statement with array of values
<p>I can't figure out the correct way to write this where statement for my controller in one line.</p>

<p>What am I missing here? </p>

<pre><code>@food_ranks = FoodRank.where("user_id = ? AND rank = ?", current_user.id, [0, 1, 2])
</code></pre>

<p>Here is my attempt to write it in 3 lines. </p>

<pre><code>@food_ranks = Array.new(FoodRank.where("user_id = #{current_user.id} AND rank = 0"))
@food_ranks &lt;&lt; FoodRank.where("user_id = #{current_user.id} AND rank = 1")
@food_ranks &lt;&lt; FoodRank.where("user_id = #{current_user.id} AND rank = 2")
</code></pre>

<p><code>@food_ranks</code> correctly displays the objects like this. Why wont it let me do something like this now?</p>

<pre><code> @food_rank each do |rank|
   rank.user_id
 end
</code></pre>

<p>Is it making <code>@food_ranks</code> literally the where statement? (undefined method)</p>