[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-15 Thread João Paulo Lins
Koz, On Thu, 2007-11-15 at 18:09 +1300, Michael Koziarski wrote: > > 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

[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-15 Thread Hongli Lai
There are more issues though. I've documented them here: http://izumi.plan99.net/blog/index.php/2007/04/07/ruby-on-railss-handling-of-uploaded-files/ To summarize: 1. Some libraries, such as RMagick, also have bugs. RMagick.read (or something) checks whether its parameter is an IO object, and if n

[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-14 Thread Michael Koziarski
> 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

[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-14 Thread João Paulo Lins
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 =

[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-14 Thread Jon Yurek
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 so

[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-14 Thread João Paulo Lins
Hi Koz, On Wed, 2007-11-14 at 18:43 +1300, Michael Koziarski wrote: > What bugs have you hit due to this optimisation?Assuming that > removing it doesn't impact too poorly on performance, and we can't > make them ducktype nicely, then it seems reasonable to remove. I had problems on issues

[Rails-core] Re: Upload - StringIO X FileTemp

2007-11-13 Thread Michael Koziarski
On Nov 13, 2007 9:11 AM, João Paulo Lins <[EMAIL PROTECTED]> wrote: > I would like to suggest Rails returns only FileTemp, because the > optimization with StringIO may cause to the programmer enter bugs in > your implementation by not knowing what type of return receive. > I know that he can take