title: Find matching values of 2 columns in Ruby on Rails
body: <p>I am reading a CSV file with RoR and printing out an HTML table but need to mark when the values of 2 separate columns match with another row.</p>
  
  <p>The CSV looks like</p>
  
  <pre><code>name | value1 | value2| value3
  bob  |    2   |   3   |   foo
  jim  |    4   |   5   |   bar
  tim  |    2   |   7   |   foo
  </code></pre>
  
  <p>I want to find when VALUE1 and VALUE3 match the values of VALUE1 and VALUE3 of another row in this CSV file (in this case: "2" &amp; "foo" match on bob and tim)</p>
  
  <p>The result would be something like:</p>
  
  <pre><code>name | value1 | value2| value3 | duplicate
  bob  |    2   |   3   |   foo  |   Y
  jim  |    4   |   5   |   bar  |   N
  tim  |    2   |   7   |   foo  |   Y
  </code></pre>
  
  <p>I'm printing the table out </p>
  
  <pre><code>&lt;% file.each do |row| %&gt;
  &lt;tr&gt;
    &lt;% row.each do |k, v| %&gt;
      &lt;td&gt;&lt;% v %&gt;&lt;/td&gt;
    &lt;% end %&gt;
  &lt;/tr&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>What I'd like to do is flag the table row when I find the matching columns.</p>