title: weird error with undefined method `gsub' for nil:NilClass and undefined method `strptime' for nil:NilClass RoR 2.3.8
body: <p>Hi I'm trying to read csv file, my code is this:</p>
  
  <pre><code>CSV.foreach(path, {:col_sep =&gt; @seperator}) do |row|
      #CSV.foreach(File.basename(path), {:col_sep =&gt; @seperator}) do |row|
          r = Route.new
          r.contact_id = contact_id
          r.name = row[0]
          r.number_range = row[1]
          r.rate = row[3].gsub(",", ".").to_f
          r.valid_from = DateTime.strptime(row[5], @time_format) 
          r.currency = @currency
          r.save
      end
  </code></pre>
  
  <p>And I'm having a problem in this lines:</p>
  
  <pre><code>        r.rate = row[3].gsub(",", ".").to_f
          r.valid_from = DateTime.strptime(row[5], @time_format) 
  </code></pre>
  
  <p>I get the errors: <code>undefined method 'gsub' for nil:NilClass</code> and </p>
  
  <pre><code>undefined method `strptime' for nil:NilClass
  </code></pre>
  
  <p>But I'm completely sure that row[3] and row[5] aren't nil, any idea about why is it happening? Thanks in advance!</p>