I''m trying to get Tempfiles to work but they randomly disappear. It
is very likely that I do not know how they work. This is what I want
to do...if you think there''s a better and accepted approach please let
me know.
I''m parsing icalendar data. I want to fetch the data from an
uploaded .ics file or from Zimbra only once. So I need to store the
data somehow during processing then discard it later. Tempfile seems
like the thing to use. Here''s my code....
def createTempFile(cal)
temp_file = Tempfile.new("calendar")
calendar_file = File.new(temp_file.path, "w+")
calendar_file.puts(cal.to_ical)
calendar_file.close
session[:calendar_path] = temp_file.path
logger.info "TEMPFILE: #{temp_file.path}"
end
I then pull the path from the session so I can use it in other
functions in the same controller. Sometime it disappears from the
temp directory sometimes it does not and I''m able to process it.
Am I missing something fundamental about how Tempfile works?
Thanks for your help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---