Process uploaded file without saving in model


I want to upload files to be processed without being saved in a model.
Sure, I can create an acts_as_attachment model for these and not save
the uploaded file, but is there any more direct solution?


if you use a form like this:

<% form_tag(csv_upload_invitations_path(), { :multipart => true }) do %>
  <%= file_field_tag "file" %>
  <%= submit_tag("upload") %>
<% end %>

you'll get the file content in params[:file]

which you should be able to process like:

CSV::Reader.parse(params[:file].read) do |parsed|

(i copy/pasted that with csv from a project, but should work with any
other file based operations just the same)

Hi Thorsten,

You're probably a mind reader. I was just going to do use this for CVS
import myself.

Just saved me a lot of time on both the model and CSV processing.

Thanks a lot!