Problem using FasterCSV on Import: Can't convert Tempfile to string

Hi,

I’m trying to import a CSV file using fasterCSV and keep getting this
error when trying to import the file.

The parameters are passed from this view:

<% form_for :dump, :url => { :controller => ‘mots’, :action =>
‘mot_csv_import’ }, :html => { :multipart => true } do |f| %>

<%= f.label :file, 'Select file to import' %>
<%= f.file_field :file -%>

<%= submit_tag "Submit" %>

<% end %>

To this action:

def mot_csv_import
header_row = true
row_number = 0
FasterCSV.foreach(params[:dump][:file]) do |row|
if not header_row
Mot.create(
:vrm => row[4],
:is_active => 0,
:is_new => 1)
row_number += 1
GC.start if row_number%50 == 0
header_row = nil
end
end
redirect_to :controller => ‘mots’, :action => ‘index’
end

Can anyone advise me where I’m going wrong, please?