title: Trouble importing csv file with ruby CSV Module
body: <p>I'm trying to use Ruby's csv module to import the records contained in a csv file to my local table in a Ruby on Rails 3 application.</p>
  
  <p>The table was created through the creation of model Movie.</p>
  
  <p>Here is what I've been executing in console:</p>
  
  <pre><code>require 'csv'
  CSV.foreach('public/uploads/VideoTitles2.csv') do |row|
      record = Movie.new(
          :media_format   =&gt; row[0], 
          :title          =&gt; row[1], 
          :copies_at_home =&gt; row[2], 
          :order          =&gt; row[3]
      )
      record.save
  end
  </code></pre>
  
  <p>The rows of the csv file match (in data type) the columns they're being passed into. Here is a shortened version of the csv file (VideoTitles2.csv) I'm attempting to import:</p>
  
  <pre><code>"DVD","LEAP OF FAITH",1,1
  "DVD","COCOON",1,2
  "DVD","TITANIC",1,3
  </code></pre>
  
  <p>where each record is separated by \n I believe. This csv file was exported from Access and its original file extension was .txt. I've manually changed it to .csv for sake of the import.</p>
  
  <p>The problem is that, after executing the above lines in rails console, I get the following output:</p>
  
  <pre><code>=&gt; nil
  </code></pre>
  
  <p>The import doesn't seem to happen. If anyone has an idea as to how I could remedy this I'd really appreciate it. </p>