title: ruby on rails - getting the data of csv table
body: <p>i'm having trouble getting the data from the csv table</p>
  <p>this is my csv table</p>
  <p><a href="https://i.stack.imgur.com/AZvPn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AZvPn.png" alt="product.csv" /></a></p>
  <p>this is my code in my model file where it's been called in my post method(create method in controller)</p>
  <pre><code>map = {}
  table = CSV.read(File.open(csvpath, &quot;r:bom|utf-8&quot;), :headers =&gt; true) 
  table.each do |row| 
      map[row['Sku Code']] = row['SKU Mfg Code']  
  end
  
  puts map
  </code></pre>
  <p>now the problem is my row['Sku Code'] and row['SKU Mfg Code'], couldn't find it's corresponding values in each row</p>
  <p>basically what I'm doing is creating a dictionary with key being 'sku code' and it's value is 'SKU mfg code'.</p>
  <p>can anyone help me here?</p>