ROR newbie here…
I’m trying to build a form to upload a CSV file, then parse and store
the
data. I have debugged this code up this point, but now when I browse to
my
csv file, and click Upload, I get this error:
“Missing template uploads/process_file.html.erb in view path…”
Here is my view (in /uploads/new.html.erb)
<% form_tag ({:action => ‘process_file’},
:multipart => true) do %>
<%= file_field_tag ‘file’ %>
<%= submit_tag "Upload" %>
<% end %>
Here is my controller, (in /controllers/uploads_controller.rb)
def process_file
post = Upload.import(params[:file])
flash[:ok] = “data imported”
redirect_to :action => index
end
and here is my model (in models/upload.rb):
def self.import(file)
FasterCSV.foreach(file.path,:headers=>“first_row”, :col_sep=>"\t") do
|row|
# here is where we will parse the data but just this stub for
now:
row.each{|row| puts “row: #{row.inspect}”}
end
end
Can anyone please point out my dumb error here?
Would sooooooooo appreciate the help (this forum rocks…have learned a
bunch here…)
–Rick