Why 'Template missing' error with form_tag?

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

the line

redirect_to :action => index

should be

redirect_to :action => :index

or is it just a typo? i don’t know why it’s not throwing an error
complaining that there’s no index variable so maybe it’s just a typo.

On Sat, Feb 19, 2011 at 2:22 AM, rixter [email protected] wrote:

Can anyone please point out my dumb error here?
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs