title: CSV Import: undefined method `path'
body: <p>I am trying to import a CSV with addresses. I am requiring 'csv' at the controller. However I get this error:</p>
  
  <pre><code>NoMethodError in AddressesController#import_addresses
  
  undefined method `path' for "testimport.csv":String
  
   Address.import(params[:file].path)
  </code></pre>
  
  <p>Address Controller</p>
  
  <pre><code>class AddressesController &lt; ApplicationController
  
    require 'csv'
  
    def import_addresses
      Address.import(params[:file].path)
      redirect_to root_url, notice: "Addresses imported."
    end
  </code></pre>
  
  <p>Address Model</p>
  
  <pre><code>def self.import(file)
      CSV.foreach(file, headers: true) do |row|
          Address.create! row.to_hash
      end
  end
  </code></pre>
  
  <p>Reference: <a href="http://ruby-doc.org/stdlib-1.9.3/libdoc/csv/rdoc/CSV.html" rel="nofollow">http://ruby-doc.org/stdlib-1.9.3/libdoc/csv/rdoc/CSV.html</a></p>