title: Remove values from Ruby map
body: <p>I have an object that looks like this in Rails console: </p>
  
  <pre><code>  pry(#&lt;User&gt;)&gt; favorite_foods
    =&gt; [#&lt;FavoriteFood id: 3, food_id: 1, user_id: 1, removed: false, created_at: "2015-09-06 00:49:35", updated_at: "2015-09-06 00:49:35"&gt;,
    #&lt;FavoriteFood id: 4, food_id: 2, user_id: 1, removed: true, created_at: "2015-09-06 12:16:56", updated_at: "2015-09-06 12:17:36"&gt;]
  </code></pre>
  
  <p>favorite_foods is in a polymorphic relationship with foods.</p>
  
  <pre><code>has_many :favorite_foods
  has_many :favorites, through: :favorite_foods, source: :food
  has_many :foods, through: :favorite_foods
  </code></pre>
  
  <p>In the favorite_food.rb model, I'm setting favorite foods by using this method: </p>
  
  <pre><code> def favorited_foods
     favorite_foods.map(&amp;:food_id).to_set
   end
  </code></pre>
  
  <p>I need to be able to remove all instances of favorite_foods where the field "removed" equals true. </p>
  
  <p>For example: from the console session above, I want favorite_foods to include food_id 3, not food_id 4. </p>
  
  <p>What is a clean way to do this in the favorited_foods method? I tried incorporating .reject and it ignored it. </p>
  
  <p>Thanks for any advice!</p>