I have a text file of the form
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
>>>>
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
>>>>
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext
etc
and I want to split it along the >>>>'s and save the remainder into Rails Models w/o hacing to save the file on the server. I know that my parser works, but I'm having difficulty figuring out how to parse the file w/o saving it to the server. I've tried calling .read on the params[:file] object, but it throws an exception saying it doesn't have that method. I'd prefer, if possible, to avoid paperclip and carrierwave. Could anyone give some sample code on how to access the text w/o having to save it?
EDIT: The code I have tried comes from this stack exchange question How to upload a text file and parse contents into database in RoR
uploaded_io = params[:file_upload]
file_contents = uploaded_io.read
file_contents.each_line do |f|
...
end