On Wed, 2007-11-14 at 10:28 -0500, Jon Yurek wrote:
> On Nov 14, 2007, at 9:29 AM, João Paulo Lins wrote:
> >   This code working for all versions and all sizes file
> >
> >     if params[:upload_file].instance_of?(StringIO)
> >        a = parser(params[:upload_file])
> >     else
> >        a = parser(params[:upload_file].open)
> >     end
> 
> Perhaps I'm missing something, but what is wrong with this?
> 
>    a = parser(params[:upload_file].read)
> 
> That already works in both cases. There's no need to open a Tempfile.


Sorry, you are right. I had not seen that TempFile delegates to File and
File is parent of IO ... 
Well, in any case it may be interesting document this kind of thing
anywhere ... 
Perhaps I am not the only one to deal with this type of thing, and the
small change in the Rails only avoid this type of misunderstanding.


- João Lins


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to