[Nitro] create_tbody?

Robert Mela rob at robmela.com
Wed Mar 28 21:14:27 EDT 2007


create_tbody? causes an exception in admin if there's a nil anywhere 
along the line of dereferences in options[:values][0][0]

What should be done about this?   Perform checks for nils and returning 
'false' rather than throwing an exception?  I believe that would be the 
right thing to do.  If so, I'll add it to my next round of patches.

The offending code:

  #--
  # gmosx: Arrgh!! dangerous method, who added this?
  #++

  def create_tbody?(options)
    return options[:values][0][0].respond_to?(:to_ary)
  end

Excerpt from darcs annotate:
 
# Following line added by [Adde latest revision of table helper by 
Kashia + test case. [kashia]
# George Moschovitis <gm at navel.gr>**20060111132424]
   def create_tbody?(options)
# Following line added by [Adde latest revision of table helper by 
Kashia + test case. [kashia]
# George Moschovitis <gm at navel.gr>**20060111132424]
     options[:values][0][0].respond_to?(:to_ary)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob.vcf
Type: text/x-vcard
Size: 116 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20070328/5d95fba4/attachment.vcf 


More information about the Nitro-general mailing list