title: Removing duplicate entries in a hash of hash with different hash values
body: <pre><code>hash_list = {
   "a"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"153", "_destroy"=&gt;"false"},
   "b"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"153", "_destroy"=&gt;"false"},
   "c"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"154", "_destroy"=&gt;"false"},
   "d"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"153", "_destroy"=&gt;"false", "id"=&gt;"5"}
  }
  </code></pre>
  
  <p>I am expecting the result as below,</p>
  
  <pre><code>{
   "c"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"154", "_destroy"=&gt;"false"},
   "d"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"153", "_destroy"=&gt;"false", "id"=&gt;"5"}
  }
  </code></pre>
  
  <p>How can I get the above result? If I do </p>
  
  <pre><code>hash_list.invert.invert
  </code></pre>
  
  <p>then, I get</p>
  
  <pre><code>{
    "b"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"153", "_destroy"=&gt;"false"},
    "c"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"154", "_destroy"=&gt;"false"},
    "d"=&gt;{"unit_id"=&gt;"43", "dep_id"=&gt;"153", "_destroy"=&gt;"false", "id"=&gt;"5"}
  } 
  </code></pre>
  
  <p>In the above result, <code>"b"</code> is actually not needed. I need to maintain the value with the id.</p>