[Nitro] Bug in Array Control.

Bryan Soto bryan.a.soto at gmail.com
Tue Feb 28 18:30:43 EST 2006


And a rude reply to self.

Problem was two-fold.

First, the :selected => item.pk line was unnecessary. Removed that and the
explosion went away. Of interest was the origin of those StringIO's. Traced
that to nitro/lib/nitro/cgi.rb. Specifically, Cgi.structure_param. When
creating an array, it would push a copy of the StringIO from the incoming
request into it.

Attached patches fix both. Nitro tests still pass, but more testers would be
good...

On 2/28/06, Bryan Soto <bryan.a.soto at gmail.com> wrote:
>
> Hi, I'm sending this out as I'm up way too late. This is a bug reported by
> Aidan.
>
> Run the following script (also attached):
>
> =begin
> #! /usr/bin/env ruby
>
> require 'nitro'
> require 'og'
>
> require 'part/admin'
>
> class ArrayControllerTest
>   property :tests, Array
> end
>
> Og.setup
>
> Nitro.start
> =end
>
> Go to /admin.
> Create a new ArrayControllerTest.
> Enter "Test" in the Tests field.
> Save.
> Edit this entry from the list.
>
> This results in the following error.
>
> *undefined method `pk' for #<StringIO:0x342edc0>
>
> * 174: if values.empty?
> 175: str << emit_array_element(:removable => false)
> 176: else
> 177: removable = values.size != 1 ? true : false
> 178: values.each do |item|
> 179: str << emit_array_element(:selected => item.pk)
> 180: end
> 181: end
> 182: str << emit_container_end
> 183: end
> 184:
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060228/d94d5b15/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bundle.zip
Type: application/zip
Size: 17849 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060228/d94d5b15/attachment.zip 


More information about the Nitro-general mailing list