On Sep 2, 2012, at 9:01 PM, renu mehta wrote:
if there’s a missing your_file.close method somewhere.
But won’t it cause a problem next time I want to upload the updated xls
to the server and then try to import it. Every week a user will upload a
xls with the same name and app has to update the db based on new data.
How will I be able to upload and try to read it again with the same name
on server if file is not released for editing? I am using the
‘Spreadsheet’ gem for import of data. Is there any other gem available
which may be better option for this functionality?
I don’t believe that any application outside of Excel is going to behave
this way. Try it on a real server and see what happens. I think you can
replace the file right out from under the process, then tell it to
re-import, and you should be good. But test it out to be sure. Just
don’t take anything Excel has to say about this as meaningful in the
context of your production server.
If this does prove to be a problem, then just rename the file on the
server as you save it. Append the current time in milliseconds or
something similar to cause it to have an unique name on disk. Or delete
the file on your server after you have read it into your database. You
won’t need it after you’ve parsed it into database records, after all.